Files
halo-theme-whitespace/src/weread.html
T
nxxy335andWorkBuddy db368f885e feat: 二级导航、豆瓣适配页、可关闭署名与全站统计
- 一级菜单子项渲染为下拉二级导航(移动端嵌套展开)
- 新增 douban.html 豆瓣收藏适配页(plugin-douban,分栏展示书影音)
- 页脚署名改为可配置名称且可关闭(默认「暖心向阳335」)
- 页脚全站数据统计可配置(文章/分类/标签/评论/访问/字数)
- 文章卡片字数+阅读时长增加 show_word_count 开关
- 修复 SinglePage 描述取用错误(spec.description -> status.excerpt)导致的 /weread、/subscriptions 白屏
- 修复 post-meta 静态类调用被禁(BigInteger.valueOf)导致的首页 500
- 文章分类链接增加间距

Co-Authored-By: WorkBuddy <noreply@workbuddy.ai>
2026-09-28 20:40:21 +08:00

68 lines
1.9 KiB
HTML

<include src="partials/layout.html">
<template name="head">
<title
th:text="|${singlePage.spec.title} - ${site.title}|"
th:if="${singlePage != null}"
>
微信读书
</title>
<style>
.weread-mount {
margin: 2rem auto;
min-height: 12rem;
}
.weread-loading {
text-align: center;
color: var(--color-text-muted);
padding: 3rem 0;
}
.weread-error {
text-align: center;
color: var(--color-primary);
padding: 3rem 0;
}
</style>
</template>
<div class="container">
<section class="weread-page">
<h1 th:text="${singlePage.spec.title}" th:if="${singlePage != null}">微信读书</h1>
<p
class="weread-intro"
th:if="${singlePage.status?.excerpt != null}"
th:utext="${singlePage.status.excerpt}"
></p>
<div class="weread-mount" id="wr-mount">
<p class="weread-loading">正在加载书架…</p>
</div>
</section>
</div>
<script th:inline="none">
(function () {
var mount = document.getElementById("wr-mount");
var BASE = "/halo-weread-plugin/shelf-html";
fetch(BASE, { headers: { Accept: "text/html" } })
.then(function (r) {
if (!r.ok) throw new Error("shelf " + r.status);
return r.text();
})
.then(function (html) {
mount.innerHTML = html;
// 重新执行被注入的脚本(innerHTML 不会自动执行脚本)
mount.querySelectorAll("script").forEach(function (s) {
var el = document.createElement("script");
el.textContent = s.textContent;
document.body.appendChild(el);
el.remove();
});
})
.catch(function () {
mount.innerHTML =
'<p class="weread-error">书架加载失败,请确认已安装并启用 halo-weread-plugin 插件。</p>';
});
})();
</script>
</include>