Compare commits

...

3 Commits

Author SHA1 Message Date
Ryan Wang
3701d3f943 Release 1.13.0 2025-08-04 14:22:04 +08:00
Anye
eb209f3155 Refactor paginations
为了提升代码的可维护性和一致性,将 tags.html、categories.html 和 archives.html 中的自定义分页逻辑替换为统一的分页模块。这样可以减少重复代码,并简化未来的维护工作。
2025-08-04 14:20:54 +08:00
Ryan Wang
d56c61a046 Add supports for docsme plugin (#250)
* docsme

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Update

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Add setting options

Signed-off-by: Ryan Wang <i@ryanc.cc>

---------

Signed-off-by: Ryan Wang <i@ryanc.cc>
2025-08-04 14:18:36 +08:00
12 changed files with 196 additions and 63 deletions

View File

@@ -500,3 +500,20 @@ spec:
name: gongan_link
label: 公安联网备案跳转链接
value: https://beian.mps.gov.cn/#/query/webSearch
- group: plugin
label: 插件集成
formSchema:
- $formkit: group
name: docsme
label: Docsme 文档管理
value:
source: theme
children:
- $formkit: select
name: source
label: 模板来源
options:
- label: 由此主题提供
value: theme
- label: 使用插件默认模板
value: plugin

View File

@@ -111,3 +111,26 @@ select {
padding-right: 1.85em;
display: inline-flex;
}
// Custom styles for docsme plugin
.dm-layout,
.dm-header__content {
@apply mx-auto max-w-7xl !important;
}
.dm-header__content {
@apply px-4 lg:px-6 !important;
}
.dm-main-content {
@apply mx-auto max-w-7xl !important;
@apply px-4 lg:px-6 !important;
}
.dm-sidebar__content {
padding: 0 1rem !important;
}
.dm-header {
z-index: 9 !important;
}

View File

@@ -74,26 +74,9 @@
<span class="text-sm font-light text-gray-600" th:text="#{common.noPosts}"></span>
</div>
<div class="mt-6 flex items-center justify-between" th:if="${archives.hasPrevious() || archives.hasNext()}">
<a
th:href="@{${archives.prevUrl}}"
class="whitespace-no-wrap group inline-flex items-center justify-center gap-1 rounded-md border border-gray-200 bg-white px-4 py-1 text-sm font-medium leading-6 text-gray-600 shadow-sm hover:bg-gray-50 focus:shadow-none focus:outline-none dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:hover:bg-slate-600 dark:hover:text-white"
>
<span class="i-tabler-arrow-left text-lg transition-all group-hover:-translate-x-1"></span>
<span th:text="#{common.previousPage}"></span>
</a>
<span
class="text-sm text-gray-900 dark:text-slate-50"
th:text="|${archives.page} / ${archives.totalPages}|"
></span>
<a
th:href="@{${archives.nextUrl}}"
class="whitespace-no-wrap group inline-flex items-center justify-center gap-1 rounded-md border border-gray-200 bg-white px-4 py-1 text-sm font-medium leading-6 text-gray-600 shadow-sm hover:bg-gray-50 focus:shadow-none focus:outline-none dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:hover:bg-slate-600 dark:hover:text-white"
>
<span th:text="#{common.nextPage}"></span>
<span class="i-tabler-arrow-right text-lg transition-all group-hover:translate-x-1"></span>
</a>
</div>
<th:block
th:replace="~{modules/pagination :: pagination(context = '/archives/', prevUrl = ${archives.prevUrl}, nextUrl = ${archives.nextUrl}, totalPages = ${archives.totalPages}, page = ${archives.page}, hasPrevious = ${archives.hasPrevious()}, hasNext = ${archives.hasNext()})}"
/>
</div>
</th:block>
</html>

View File

@@ -26,15 +26,9 @@
<div th:if="${posts.total == 0}" class="mt-6 flex items-center justify-center">
<span class="text-sm font-light text-gray-600" th:text="#{common.noPosts}"></span>
</div>
<div th:if="${posts.total gt 10}" class="mt-10 flex justify-end">
<a
class="group inline-flex items-center gap-2 truncate text-sm text-gray-600 hover:text-gray-900 dark:text-slate-100 dark:hover:text-slate-200"
th:href="@{${categories[0].status.permalink}}"
>
<span th:text="#{page.tags.morePosts}"></span>
<span class="i-tabler-chevron-right -translate-x-1 text-lg transition-all group-hover:translate-x-0"></span>
</a>
</div>
<th:block
th:replace="~{modules/pagination :: pagination(context = |${categories[0].status.permalink}/|, prevUrl = ${posts.prevUrl}, nextUrl = ${posts.nextUrl}, totalPages = ${posts.totalPages}, page = ${posts.page}, hasPrevious = ${posts.hasPrevious()}, hasNext = ${posts.hasNext()})}"
/>
</th:block>
</th:block>
</th:block>

View File

@@ -0,0 +1,23 @@
<th:block th:if="${theme.config.plugin.docsme.source == 'plugin'}">
<th:block th:replace="~{plugin:plugin-docsme:doc-catalog}" />
</th:block>
<th:block th:if="${theme.config.plugin.docsme.source == 'theme'}">
<!doctype html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/doc-layout :: html(title = ${site.title}, hero = null, content = ~{::content}, head = ~{::head}, footer = null, sidebar = null, contentClass = null)}"
>
<th:block th:fragment="head">
<th:block th:replace="~{plugin:plugin-docsme:modules/style}" />
<th:block th:replace="~{plugin:plugin-docsme:modules/script}" />
<th:block th:replace="~{plugin:plugin-docsme:modules/plugin-scripts}" />
</th:block>
<th:block th:fragment="content">
<div class="dm-container">
<th:block th:replace="~{plugin:plugin-docsme:modules/header :: header (showThemeSwitcher = false)}" />
<th:block th:replace="~{plugin:plugin-docsme:modules/doc-catalog :: doc-catalog (footer = null)}" />
</div>
</th:block>
</html>
</th:block>

24
templates/doc.html Normal file
View File

@@ -0,0 +1,24 @@
<th:block th:if="${theme.config.plugin.docsme.source == 'plugin'}">
<th:block th:replace="~{plugin:plugin-docsme:doc}" />
</th:block>
<th:block th:if="${theme.config.plugin.docsme.source == 'theme'}">
<!doctype html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/doc-layout :: html(title = ${site.title}, hero = null, content = ~{::content}, head = ~{::head}, footer = null, sidebar = null, contentClass = null)}"
>
<th:block th:fragment="head">
<th:block th:replace="~{plugin:plugin-docsme:modules/style}" />
<th:block th:replace="~{plugin:plugin-docsme:modules/script}" />
<th:block th:replace="~{plugin:plugin-docsme:modules/prism}" />
<th:block th:replace="~{plugin:plugin-docsme:modules/plugin-scripts}" />
</th:block>
<th:block th:fragment="content">
<div class="dm-container">
<th:block th:replace="~{plugin:plugin-docsme:modules/header :: header (showThemeSwitcher = false)}" />
<th:block th:replace="~{plugin:plugin-docsme:modules/doc :: doc (footer = null)}" />
</div>
</th:block>
</html>
</th:block>

23
templates/docs.html Normal file
View File

@@ -0,0 +1,23 @@
<th:block th:if="${theme.config.plugin.docsme.source == 'plugin'}">
<th:block th:replace="~{plugin:plugin-docsme:docs}" />
</th:block>
<th:block th:if="${theme.config.plugin.docsme.source == 'theme'}">
<!doctype html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/doc-layout :: html(title = ${site.title}, hero = null, content = ~{::content}, head = ~{::head}, footer = null, sidebar = null, contentClass = null)}"
>
<th:block th:fragment="head">
<th:block th:replace="~{plugin:plugin-docsme:modules/style}" />
<th:block th:replace="~{plugin:plugin-docsme:modules/script}" />
</th:block>
<th:block th:fragment="content">
<div class="dm-container">
<th:block
th:replace="~{plugin:plugin-docsme:modules/docs :: docs (footer = null, showHeader = false, showThemeSwitcher = false)}"
/>
</div>
</th:block>
</html>
</th:block>

View File

@@ -0,0 +1,26 @@
<th:block th:fragment="base-head(title)">
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2" />
<title th:text="${title}"></title>
<link th:unless="${#strings.isEmpty(site.logo)}" rel="preload" th:href="${site.logo}" as="image" />
<link rel="stylesheet" th:href="@{/assets/dist/style.css?v={version}(version=${theme.spec.version})}" />
<script th:inline="javascript">
window.i18nResources = {
"jsModule.colorSchemeSwitcher.dark": `[(#{jsModule.colorSchemeSwitcher.dark})]`,
"jsModule.colorSchemeSwitcher.light": `[(#{jsModule.colorSchemeSwitcher.light})]`,
"jsModule.colorSchemeSwitcher.auto": `[(#{jsModule.colorSchemeSwitcher.auto})]`,
"jsModule.share.qzone": `[(#{jsModule.share.qzone})]`,
"jsModule.share.weibo": `[(#{jsModule.share.weibo})]`,
"jsModule.share.douban": `[(#{jsModule.share.douban})]`,
"jsModule.share.wechat": `[(#{jsModule.share.wechat})]`,
"jsModule.share.native": `[(#{jsModule.share.native})]`,
"jsModule.share.windowTitle": `[(#{jsModule.share.windowTitle})]`,
"jsModule.upvote.networkError": `[(#{jsModule.upvote.networkError})]`,
};
</script>
<script th:src="@{/assets/dist/main.iife.js?v={version}(version=${theme.spec.version})}"></script>
<script>
main.initColorScheme("[[${theme.config.style.color_scheme}]]",[[${theme.config.style.enable_change_color_scheme}]])
</script>
</th:block>

View File

@@ -0,0 +1,48 @@
<!doctype html>
<html th:lang="${#locale.toLanguageTag}" th:fragment="html (title,hero,content,head,footer,sidebar,contentClass)">
<head>
<th:block th:replace="~{modules/base-head :: base-head(title = ${title})}" />
<script>
var docsme = {
disableThemeFunction: true,
};
</script>
<th:block th:if="${head != null}">
<th:block th:replace="${head}" />
</th:block>
<style>
footer {
margin: 0 !important;
}
#header-menu {
box-shadow: none !important;
}
#btn-search {
display: none !important;
}
</style>
</head>
<body>
<th:block th:replace="~{modules/header}" />
<section class="w-full" th:classappend="${contentClass}">
<th:block th:replace="${content}" />
</section>
<th:block th:replace="~{modules/footer}" />
<button
th:if="${theme.config.global.show_scroll_button}"
type="button"
id="btn-scroll-to-top"
th:aria-label="#{fragment.layout.toTop}"
class="fixed bottom-5 right-5 flex items-center justify-center rounded-full bg-white p-3 opacity-0 shadow transition-all duration-300 hover:opacity-70 hover:shadow-lg dark:bg-slate-600 lg:bottom-10 lg:right-10"
>
<span class="i-tabler-chevron-up text-2xl text-gray-600 dark:text-slate-200"></span>
</button>
</body>
</html>

View File

@@ -1,33 +1,11 @@
<!doctype html>
<html th:lang="${#locale.toLanguageTag}" th:fragment="html (title,hero,content,head,footer,sidebar,contentClass)">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2" />
<title th:text="${title}"></title>
<link th:unless="${#strings.isEmpty(site.logo)}" rel="preload" th:href="${site.logo}" as="image" />
<link rel="stylesheet" th:href="@{/assets/dist/style.css?v={version}(version=${theme.spec.version})}" />
<script th:inline="javascript">
window.i18nResources = {
"jsModule.colorSchemeSwitcher.dark": `[(#{jsModule.colorSchemeSwitcher.dark})]`,
"jsModule.colorSchemeSwitcher.light": `[(#{jsModule.colorSchemeSwitcher.light})]`,
"jsModule.colorSchemeSwitcher.auto": `[(#{jsModule.colorSchemeSwitcher.auto})]`,
"jsModule.share.qzone": `[(#{jsModule.share.qzone})]`,
"jsModule.share.weibo": `[(#{jsModule.share.weibo})]`,
"jsModule.share.douban": `[(#{jsModule.share.douban})]`,
"jsModule.share.wechat": `[(#{jsModule.share.wechat})]`,
"jsModule.share.native": `[(#{jsModule.share.native})]`,
"jsModule.share.windowTitle": `[(#{jsModule.share.windowTitle})]`,
"jsModule.upvote.networkError": `[(#{jsModule.upvote.networkError})]`,
};
</script>
<script th:src="@{/assets/dist/main.iife.js?v={version}(version=${theme.spec.version})}"></script>
<th:block th:replace="~{modules/base-head :: base-head(title = ${title})}" />
<th:block th:if="${head != null}">
<th:block th:replace="${head}" />
</th:block>
<script>
main.initColorScheme("[[${theme.config.style.color_scheme}]]",[[${theme.config.style.enable_change_color_scheme}]])
</script>
</head>
<body class="bg-slate-50 dark:bg-slate-900">
<th:block th:replace="~{modules/header}" />

View File

@@ -28,15 +28,9 @@
<span class="text-sm font-light text-gray-600 dark:text-slate-200" th:text="#{common.noPosts}"></span>
</div>
<div th:if="${posts.total gt 10}" class="mt-10 flex justify-end">
<a
class="group inline-flex items-center gap-2 truncate text-sm text-gray-600 hover:text-gray-900 dark:text-slate-100 dark:hover:text-slate-200"
th:href="@{${tag.status.permalink}}"
>
<span th:text="#{page.tags.morePosts}"></span>
<span class="i-tabler-chevron-right -translate-x-1 text-lg transition-all group-hover:translate-x-0"></span>
</a>
</div>
<th:block
th:replace="~{modules/pagination :: pagination(context = |${tag.status.permalink}/|, prevUrl = ${posts.prevUrl}, nextUrl = ${posts.nextUrl}, totalPages = ${posts.totalPages}, page = ${posts.page}, hasPrevious = ${posts.hasPrevious()}, hasNext = ${posts.hasNext()})}"
/>
</th:block>
</th:block>
</th:block>

View File

@@ -18,7 +18,7 @@ spec:
issues: https://github.com/halo-dev/theme-earth/issues
settingName: "theme-earth-setting"
configMapName: "theme-earth-configMap"
version: 1.12.5
version: 1.13.0
requires: ">=2.20.0"
license:
- name: "GPL-3.0"