Files
halo-theme-WarmIsland/public/fragments/post-list.html
T
Ryan Wang 184ff9351d Extract post list into reusable fragment
Add public/fragments/post-list.html containing the shared post list markup, and update src/pages/category.astro and src/pages/index.astro to replace the in-file duplicate list with <th:block th:replace="~{fragments/post-list}"></th:block>. This removes duplicated template code and centralizes the post list for easier maintenance; existing empty-feed and pagination logic remain unchanged.
2026-04-07 23:26:08 +08:00

20 lines
673 B
HTML

<ul class="post-feed__list" role="list">
<li th:each="post : ${posts.items}" class="post-feed__item">
<a class="post-feed__link" th:href="@{${post.status.permalink}}">
<div class="post-feed__body">
<p
class="post-feed__date"
th:text="${#dates.format(post.spec.publishTime, 'yyyy-MM-dd')}"
></p>
<h2 class="post-feed__title" th:text="${post.spec.title}"></h2>
<p class="post-feed__excerpt" th:text="${post.status.excerpt}"></p>
</div>
<img
th:unless="${#strings.isEmpty(post.spec.cover)}"
class="post-feed__image"
th:src="${post.spec.cover}"
/>
</a>
</li>
</ul>