feat: 插件适配页面与系统完善(v0.1.0)

- 修复 /categories、/tags 因变量为 List 误用 .items 导致的 500
- 新增 layout.html 布局契约,消除插件页面 fallback 警告
- 适配 plugin-moments / plugin-photos / plugin-links(含友链申请表单与 RSS 订阅页)
- 适配 halo-weread-plugin(书架页)、留言板单页模板
- 适配 plugin-extra-api 的代码高亮与暗色样式
- 修复暗黑模式评论区不可见(补充 color-scheme 与兜底样式)
- 更新元数据:作者暖心向阳335、版本 0.1.0、requires >=2.26.0
This commit is contained in:
2026-09-28 16:50:09 +08:00
parent 2ed0c768a4
commit 8e6dccbd09
35 changed files with 3986 additions and 301 deletions
+67
View File
@@ -0,0 +1,67 @@
<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.spec.description != null}"
th:utext="${singlePage.spec.description}"
></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>