From 6b8d9ee338a767781a90e901ad5af125556d770b Mon Sep 17 00:00:00 2001 From: nxxy335 Date: Mon, 28 Sep 2026 17:37:16 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E9=9B=86=E6=88=90=20extra-api=20?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E3=80=81=E9=A1=B5=E8=84=9A=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E3=80=81=E5=8F=8B=E9=93=BE=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=86=85=E5=B5=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - extra-api: 文章卡片/详情页展示字数+阅读时长、归档页展示全站总字数、瞬间页展示单条字数(pluginFinder.available 守卫,未安装自动隐藏) - 页脚新增 ICP 备案号与公网安备号配置(settings.yaml footer 分组,partials/layout.html 渲染并加安全导航守卫) - 友链申请表单由独立单页改为内嵌 /links 页底部(点击「申请友链」展开),移除独立 links-apply.html 及其自定义模板注册 - 重新打包 dist/whitespace-0.1.0.zip(移除陈旧 1.0.0) --- README.md | 10 +- i18n/default.properties | 7 ++ i18n/zh_CN.properties | 7 ++ settings.yaml | 25 +++++ src/archives.html | 11 ++ src/css/main.css | 32 ++++++ src/links-apply.html | 201 ------------------------------------ src/links.html | 204 +++++++++++++++++++++++++++++++++++++ src/modules/post-meta.html | 14 +++ src/moments.html | 9 ++ src/partials/layout.html | 29 ++++++ theme.yaml | 4 - 12 files changed, 344 insertions(+), 209 deletions(-) delete mode 100644 src/links-apply.html diff --git a/README.md b/README.md index bba046a..ee9824f 100644 --- a/README.md +++ b/README.md @@ -23,14 +23,13 @@ - **plugin-moments**:`/moments` 瞬间页 - **plugin-photos**:`/photos` 图库页 -- **plugin-links**:`/links` 友链页;并额外提供 - - `links-apply.html`:访客友链申请表单(调用插件公共 REST API,含图形验证码) +- **plugin-links**:`/links` 友链页;友链申请表单已**直接内嵌**在友链页底部(点击「申请友链」展开,调用插件公共 REST API,含图形验证码);并额外提供 - `links-subscribe.html`:RSS 订阅动态聚合页(使用 `linkFeedFinder`) - **halo-weread-plugin**:`weread.html` 微信读书书架页(前端拉取插件 `/shelf-html` 并注入) - **留言板**:`page_guestbook.html` 以评论区作为留言板的单页模板 -- **plugin-extra-api**:API 扩展包(无独立页面),主题已适配其 shiki 代码高亮与暗色样式 +- **plugin-extra-api**:API 扩展包(无独立页面),主题已适配其 shiki 代码高亮与暗色样式;并在文章卡片 / 详情页展示**字数 + 阅读时长**、归档页展示**全站总字数**、瞬间页展示**单条字数**(通过 `extraApiStatsFinder`,插件未安装时自动隐藏) -> `weread` / `留言板` / `友链申请` / `链接订阅` 均为「自定义页面模板」,在控制台新建单页并选择对应模板即可启用。 +> `weread` / `留言板` / `链接订阅` 均为「自定义页面模板」,在控制台新建单页并选择对应模板即可启用。`/links` 友链页与内嵌的友链申请无需单独建单页。 ## 目录结构 @@ -86,6 +85,8 @@ pnpm check # 格式化 + Lint 修复 | about | avatar / bio / github_url / twitter_url / contact_email | 关于页(自定义模板 `page_about.html`)内容 | | seo | enable_metadata | 输出 canonical / Open Graph / Twitter Card | | seo | enable_structured_data | 输出文章页 BlogPosting JSON-LD | +| footer | icp_number / icp_url | ICP 备案号与查询链接(默认工信部备案管理系统) | +| footer | police_number / police_url | 公网安备号与查询链接(默认全国互联网安全管理服务平台) | ## 约定与说明 @@ -93,6 +94,7 @@ pnpm check # 格式化 + Lint 修复 - 社交分享 / 结构化数据中用 `status.permalink` 与 `site.routes.*` 拼出地址,不写死可配置路由。 - 搜索由官方 `PluginSearchWidget` 插件提供,按钮仅在插件可用时出现。 - 浏览量来自 Halo 原生统计(`post.stats.visit`),无需主题自行计数。 +- 字数 / 阅读时长来自 `halo-plugin-extra-api` 的 `extraApiStatsFinder`(插件未安装时相关展示自动隐藏),全站字数为缓存计算结果。 ## 致谢 diff --git a/i18n/default.properties b/i18n/default.properties index 76143d2..792e37f 100644 --- a/i18n/default.properties +++ b/i18n/default.properties @@ -33,3 +33,10 @@ footer.theme=Theme by {0} about.social.github=GitHub about.social.twitter=Twitter about.social.email=Email +post.words={0} words +post.reading_time=About {0} min +archive.stats.words=Total words +links.apply=Apply for link +links.apply_sent=Application submitted, awaiting review. +links.apply_failed=Submission failed, please check and retry. +links.apply_captcha_failed=Captcha failed to load, please refresh. diff --git a/i18n/zh_CN.properties b/i18n/zh_CN.properties index 1b844a0..f00e270 100644 --- a/i18n/zh_CN.properties +++ b/i18n/zh_CN.properties @@ -33,3 +33,10 @@ footer.theme=Theme by {0} about.social.github=GitHub about.social.twitter=Twitter about.social.email=邮箱 +post.words={0} 字 +post.reading_time=约 {0} 分钟 +archive.stats.words=总字数 +links.apply=申请友链 +links.apply_sent=申请已提交,等待管理员审核。 +links.apply_failed=提交失败,请检查信息后重试。 +links.apply_captcha_failed=验证码加载失败,请刷新页面重试。 diff --git a/settings.yaml b/settings.yaml index ff337e2..95ba5c7 100644 --- a/settings.yaml +++ b/settings.yaml @@ -74,3 +74,28 @@ spec: label: 输出文章结构化数据 value: true help: 在文章页输出 Schema.org BlogPosting JSON-LD;若已由插件提供,请关闭 + - group: footer + label: 页脚备案 + formSchema: + - $formkit: text + name: icp_number + label: ICP 备案号 + value: "" + placeholder: 京ICP备12345678号 + help: 工信部备案号,留空则不显示 + - $formkit: text + name: icp_url + label: ICP 备案查询链接 + value: "https://beian.miit.gov.cn" + help: 点击备案号跳转的查询地址,默认工信部备案管理系统 + - $formkit: text + name: police_number + label: 公网安备号 + value: "" + placeholder: 京公网安备11000002000001号 + help: 公安机关备案号,留空则不显示 + - $formkit: text + name: police_url + label: 公网安备查询链接 + value: "https://beian.mps.gov.cn" + help: 点击公网安备号跳转的地址,默认全国互联网安全管理服务平台 diff --git a/src/archives.html b/src/archives.html index d936c5e..858f421 100644 --- a/src/archives.html +++ b/src/archives.html @@ -38,6 +38,17 @@ Tags + +
+
0
+
+ Words +
+
+
diff --git a/src/css/main.css b/src/css/main.css index 1f292f7..253ebc1 100644 --- a/src/css/main.css +++ b/src/css/main.css @@ -1113,6 +1113,38 @@ a.pagination-item:hover { color: var(--color-primary); } +.footer-beian { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 0.5rem 1rem; + margin-top: var(--spacing-sm); + font-size: 0.75rem; + color: var(--color-text-muted); +} +.footer-beian-item { + display: inline-flex; + align-items: center; + gap: 0.35rem; + color: var(--color-text-muted); +} +.footer-beian-item:hover { + color: var(--color-text); +} +.footer-police-icon { + width: 0.95rem; + height: 0.95rem; +} + +.post-words, +.post-reading { + color: var(--color-text-muted); +} +.moment-words { + color: var(--color-text-secondary); + font-size: 0.85rem; +} + /* ======================================== 回到顶部按钮 ======================================== */ diff --git a/src/links-apply.html b/src/links-apply.html deleted file mode 100644 index e224c3c..0000000 --- a/src/links-apply.html +++ /dev/null @@ -1,201 +0,0 @@ - - - -
-
-

申请友链

-

- - - - -
-
- - -
diff --git a/src/links.html b/src/links.html index b38f2a0..8803920 100644 --- a/src/links.html +++ b/src/links.html @@ -56,6 +56,71 @@ font-size: 0.85rem; color: var(--color-text-secondary); } + .links-apply { + margin-top: 2rem; + text-align: center; + } + .link-apply-panel { + max-width: 32rem; + margin: 1.25rem auto 0; + text-align: left; + } + .link-apply-title { + margin: 0 0 0.75rem; + font-size: 1.125rem; + } + .apply-form .form-row { + margin-bottom: 1rem; + } + .apply-form label { + display: block; + margin-bottom: 0.35rem; + font-weight: 600; + color: var(--color-text); + } + .apply-form input, + .apply-form textarea { + width: 100%; + padding: 0.6rem 0.75rem; + border: 1px solid var(--color-border); + border-radius: var(--radius-sm); + background: var(--color-bg); + color: var(--color-text); + font: inherit; + } + .apply-form textarea { + min-height: 5rem; + resize: vertical; + } + .apply-captcha { + display: flex; + gap: 0.75rem; + align-items: center; + } + .apply-captcha img { + height: 2.75rem; + border-radius: var(--radius-sm); + border: 1px solid var(--color-border); + cursor: pointer; + } + .apply-status { + margin-top: 1rem; + padding: 0.75rem 1rem; + border-radius: var(--radius-sm); + display: none; + } + .apply-status.ok { + display: block; + background: rgba(46, 160, 67, 0.12); + color: #2ea043; + border: 1px solid rgba(46, 160, 67, 0.4); + } + .apply-status.err { + display: block; + background: rgba(229, 57, 53, 0.12); + color: #e53935; + border: 1px solid rgba(229, 57, 53, 0.4); + } @@ -96,10 +161,149 @@

暂无链接

+ +
+ + diff --git a/src/modules/post-meta.html b/src/modules/post-meta.html index 606bddc..8467a88 100644 --- a/src/modules/post-meta.html +++ b/src/modules/post-meta.html @@ -23,4 +23,18 @@ >1 views + + + + + 字数 + + 阅读时长 + + + diff --git a/src/moments.html b/src/moments.html index 0b8274e..6c0c126 100644 --- a/src/moments.html +++ b/src/moments.html @@ -91,6 +91,15 @@ >发布时间 + + 字数 +
kehua

+
diff --git a/theme.yaml b/theme.yaml index 429ca96..7b12294 100644 --- a/theme.yaml +++ b/theme.yaml @@ -33,10 +33,6 @@ spec: description: 以评论区作为留言板的单页模板 screenshot: file: page_guestbook.html - - name: 友链申请页面 - description: 适配 plugin-links 的访客友链申请表单 - screenshot: - file: links-apply.html - name: 链接订阅页面 description: 适配 plugin-links 的 RSS 订阅动态聚合页 screenshot: