<section th:fragment="stats-widget" class="widget">
  <hgroup class="widget-title text-creative">博客统计</hgroup>
  <div class="widget-body widget-card">
    <dl class="dl-group small">
      <div>
        <dt>运营时长</dt>
        <dd id="site-runtime" th:title="'博客于' + ${theme.config.aside.basic.site_start_time} + '上线'">-</dd>
      </div>
      <div>
        <dt>上次更新</dt>
        <dd class="time-ago" id="latest-update-time" data-time="">-</dd>
        <script th:inline="javascript">
          (function () {
            var posts = /*[[${postFinder.list({page: 1, size: 1, sort: {'spec.publishTime,desc'}}).items}]]*/ [];
            if (posts && posts.length > 0) {
              var latest = posts[0].spec && posts[0].spec.publishTime;
              if (latest) {
                document.getElementById("latest-update-time").dataset.time = latest;
              }
            }
          })();
        </script>
      </div>
      <div>
        <dt>文章数目</dt>
        <dd th:text="${postFinder.archives(1, 1).total}">0</dd>
      </div>
    </dl>
  </div>
  <th:block th:replace="~{modules/aside-widgets/scripts/stats-scripts :: stats-scripts}"></th:block>
</section>
