<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'archive')}"
      xmlns:th="http://www.thymeleaf.org">

<th:block th:fragment="content">

    <div class="page" id="body-wrap">
        <header class="not-top-img" id="page-header">
            <nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
        </header>
        <main class="layout" id="content-inner">
            <!-- archive -->
            <div id="archive">
                <div class="article-sort-title">文章 - [[${siteStatsFinder.getStats().post}]]</div>
                <div class="article-sort" th:each="archive : ${archives.items}"
                     th:with='postRandomImg=${#strings.contains(theme.config.layout.postRandomImg,"?") ? theme.config.layout.postRandomImg+"," : theme.config.layout.postRandomImg+"?"}'>
                    <div class="article-sort-item year" th:text="${archive.year}"></div>
                    <div class="article-sort" th:each="month : ${archive.months}">
                        <!-- 月份没有样式所以不显示 -->
                        <!-- <div class="article-sort-item" th:text="${month.month}"></div> -->
                        <div class="article-sort-item" th:each="post : ${month.posts}">
                            <a class="article-sort-item-img" th:href="@{${post.status.permalink}}"
                               th:title="${post.spec.title}">
                                <img th:alt="${post.spec.title}"
                                     th:src="${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}">
                            </a>
                            <div class="article-sort-item-info">
                                <div class="article-sort-item-time"><i class="far fa-calendar-alt"></i>
                                    <time class="post-meta-date-created"
                                          th:attr="datetime=${#dates.format(post.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}"
                                          th:text="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}"
                                          th:title="'创建于' + ${#dates.format(post.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}">
                                    </time>
                                </div>
                                <a class="article-sort-item-title" onclick="window.event.cancelBubble=!0"
                                   th:href="@{${post.status.permalink}}" th:text="${post.spec.title}"
                                   th:title="${post.spec.title}"></a>
                                <div class="article-sort-item-tags">
                                    <a class="article-meta__tags"
                                       th:each="tag : ${post.tags}" th:href="@{${tag.status.permalink}}">
                                        <span class="tags-punctuation">[[${tag.spec.displayName}]]</span>
                                    </a>
                                    <span class="article-meta__link">•</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 分页 -->
                <div th:replace="~{modules/widgets/page :: page('/archives',${archives})}"></div>
            </div>
            <!-- sidebar -->
            <div th:replace="~{modules/aside :: aside(${theme.config.sidebar.widgetss.categoryWidgets})}"></div>
        </main>
        <!-- 底部 -->
        <footer th:replace="~{modules/footer :: footer}"></footer>
    </div>

</th:block>

</html>