For AI agents: the complete documentation index is available at https://docs.halo.run/llms.txt, the full documentation bundle is available at https://docs.halo.run/llms-full.txt, and this page is available as Markdown at https://docs.halo.run/developer-guide/theme/finder-apis/site-stats.md.

站点统计

本页 API 自 Halo 2.0.0 起可用。

getStats()

siteStatsFinder.getStats();

描述

获取站点的统计信息。

参数

返回值

#SiteStatsVo

示例

<ul th:with="stats = ${siteStatsFinder.getStats()}">
  <li th:text="${stats.visit}"></li>
  <li th:text="${stats.post}"></li>
</ul>

类型定义

SiteStatsVo

SiteStatsVo
{
  "visit": 0, // 访问数量
  "upvote": 0, // 点赞数量
  "comment": 0, // 评论数量
  "post": 0, // 文章数量
  "category": 0, // 分类数量
}