diff --git a/_config.yml b/_config.yml
index dc65e6b7..2f6d57ef 100644
--- a/_config.yml
+++ b/_config.yml
@@ -106,10 +106,7 @@ defaults:
path: ""
values:
layout: document
- read_time: false
- author_profile: false
- share: false
- comments: false
+ show_date: true
sidebar:
nav: docs
hits: true
diff --git a/_data/settings.yaml b/_data/settings.yaml
index 085ee191..0660e18e 100644
--- a/_data/settings.yaml
+++ b/_data/settings.yaml
@@ -31,3 +31,9 @@ appearance_skin:
- sunrise
- catppuccin_latte
- catppuccin_mocha
+miscellaneous_hits:
+ type: radio
+ default: enable
+ options:
+ - enable
+ - disable
diff --git a/_layouts/document.html b/_layouts/document.html
index 3b4bd7db..2605dcd2 100644
--- a/_layouts/document.html
+++ b/_layouts/document.html
@@ -2,12 +2,13 @@
layout: single
---
-{% if jekyll.environment == 'production' and page.hits %}
-
-{% endif %}
-
-
-
本文由 {{ page.author | default: '未署名用户' }} 创建{% if page.contributors %},并由 {{ page.contributors | join: ' ' }} 编辑{% endif %}。
-
-
{{ content }}
+
+{% if page.author or page.contributors or jekyll.environment == 'production' and page.hits %}
+
+
+{% endif %}
diff --git a/assets/js/meta.js b/assets/js/meta.js
new file mode 100644
index 00000000..05dce590
--- /dev/null
+++ b/assets/js/meta.js
@@ -0,0 +1,40 @@
+(() => {
+ const pageTitle = document.getElementById("page-title");
+ if (pageTitle === null) return;
+ const header = pageTitle.parentElement;
+ let metas = header.getElementsByClassName("page__meta")[0];
+ if (metas === null) {
+ metas = document.createElement("div");
+ element.className = "page__meta";
+ header.append(element);
+ }
+ window.appendMeta = (text, icon) => {
+ if (metas.children.length > 0) {
+ const sep = document.createElement("span");
+ sep.className = "page__meta-sep";
+ metas.append(sep);
+ }
+ const meta = document.createElement("span");
+ if (icon !== undefined) {
+ const metaIcon = document.createElement("i");
+ metaIcon.className = icon;
+ meta.append(metaIcon, " ");
+ }
+ meta.append(text.trim());
+ metas.append(meta);
+ };
+ window.hits = (tag) => {
+ if (settings.get("miscellaneous_hits") === "disable") return;
+ const hitsUrl = new URL("https://hits.zkitefly.eu.org");
+ hitsUrl.searchParams.set("tag", tag);
+ fetch(hitsUrl, { method: "HEAD" }).then((response) => {
+ if (response.status !== 200) return;
+ const { headers } = response;
+ const total = headers.get("X-Total-Hits");
+ const today = headers.get("X-Today-Hits");
+ if (total !== null && today !== null) {
+ appendMeta(today + " / " + total, "far fa-eye");
+ }
+ });
+ };
+})();
diff --git a/settings.yaml b/settings.yaml
index dd911319..7462dfc2 100644
--- a/settings.yaml
+++ b/settings.yaml
@@ -37,4 +37,12 @@ data:
sunrise: 日出 (Sunrise)
catppuccin_latte: Catppuccin Latte
catppuccin_mocha: Catppuccin Mocha
+ - title: 杂项
+ settings:
+ miscellaneous_hits:
+ title: 访问统计服务
+ description: 用于统计页面访问量的服务。
+ options:
+ enable: 启用
+ disable: 禁用
---