1. 侧栏标签长度设置

2. 侧栏分类长度设置
3. 自定义文章导航栏及其他路径
4. 添加公安备案设置
5. fix 不能修改 banner 名称的问题
This commit is contained in:
liuzhihang 2022-12-11 15:05:41 +08:00
parent c657c38fb3
commit 39c1caca7d
15 changed files with 217 additions and 19 deletions

View File

@ -11,9 +11,10 @@
文档:[语雀](https://www.yuque.com/liuzhihangs/halo-theme-hao) 文档:[语雀](https://www.yuque.com/liuzhihangs/halo-theme-hao)
> Halo-Theme-Hao 是一款 [Halo2.0](https://github.com/halo-dev/halo) 的博客主题 > halo-theme-hao 是一款 [Halo2.0](https://github.com/halo-dev/halo) 的博客主题
> >
> 移植于 Hexo 社区 [hexo-theme-butterfly](https://github.com/jerryc127/hexo-theme-butterfly) 主题中 [Heo](https://blog.zhheo.com/) 的魔改 > 移植于 Hexo 社区 [hexo-theme-butterfly](https://github.com/jerryc127/hexo-theme-butterfly)
> 主题中 [Heo](https://blog.zhheo.com/) 的魔改
## 安裝 ## 安裝

View File

@ -15,6 +15,11 @@ spec:
label: ICP 备案 label: ICP 备案
placeholder: 请输入 ICP 备案号 placeholder: 请输入 ICP 备案号
help: "京ICP备xxxxxxxx号" help: "京ICP备xxxxxxxx号"
- $formkit: text
name: gongan
label: 公安备案
placeholder: 请输入公安备案号
help: "皖公网安备 xxxxxxxx号"
- $formkit: url - $formkit: url
name: copyrightAgreement name: copyrightAgreement
label: 版权协议 label: 版权协议
@ -56,14 +61,14 @@ spec:
value: true value: true
- label: 隐藏 - label: 隐藏
value: false value: false
- $formkit: text - $formkit: textarea
if: "$get(recentTop).value" if: "$get(recentTop).value"
name: bannersTitleBig name: bannersTitleBig
label: Banners 大标题 label: Banners 大标题
placeholder: 请输入大标题 placeholder: 请输入大标题
value: Halo Theme Hao value: Halo Theme Hao
help: 支持 HTML 语法 help: 支持 HTML 语法
- $formkit: text - $formkit: textarea
if: "$get(recentTop).value" if: "$get(recentTop).value"
name: bannersTitleSmall name: bannersTitleSmall
label: Banners 小标题 label: Banners 小标题
@ -71,6 +76,7 @@ spec:
value: 更多信息请关注 GitHub value: 更多信息请关注 GitHub
help: 支持 HTML 语法 help: 支持 HTML 语法
- $formkit: select - $formkit: select
if: "$get(recentTop).value"
name: bannersBackground name: bannersBackground
label: 文章列表布局 label: 文章列表布局
value: default value: default
@ -173,9 +179,77 @@ spec:
- group: layout - group: layout
label: 布局 label: 布局
formSchema: formSchema:
- $formkit: select
name: nav
id: nav
key: nav
label: 文章导航
value: category
options:
- label: 分类
value: category
- label: 标签
value: tag
# - label: 自定义分类
# value: custom-category
# - label: 自定义标签
# value: custom-tag
- label: 自定义路径
value: custom-url
# - $formkit: repeater
# if: "$get(nav).value === 'custom-category'"
# name: navCustomCategory
# label: 自定义分类
# value: [ ]
# children:
# - $formkit: categorySelect
# name: category
# label: 分类
# - $formkit: repeater
# if: "$get(nav).value === 'custom-tag'"
# name: navCustomTag
# label: 自定义标签
# value: [ ]
# children:
# - $formkit: tagSelect
# name: tag
# label: 标签
- $formkit: repeater
if: "$get(nav).value === 'custom-url'"
name: navCustomUrl
label: 自定义路径
value: [ ]
children:
- $formkit: text
name: title
label: 标题
- $formkit: url
name: url
label: 链接
- $formkit: select
name: navMore
id: navMore
key: navMore
label: 文章导航更多跳转地址
value: hide
options:
- label: 隐藏
value: hide
- label: 分类
value: categories
- label: 标签
value: tags
- label: 自定义地址
value: customUrl
- $formkit: url
if: "$get(navMore).value === customUrl"
name: navMoreCustomUrl
label: 文章导航更多跳转路径
value:
- $formkit: select - $formkit: select
name: cols name: cols
label: 文章列表布局 label: 文章布局
value: col2 value: col2
options: options:
- label: 单列 - label: 单列
@ -332,7 +406,6 @@ spec:
- $formkit: url - $formkit: url
name: url name: url
label: 链接 label: 链接
validation: "url"
- $formkit: radio - $formkit: radio
name: urlType name: urlType
label: 链接类型 label: 链接类型
@ -359,6 +432,16 @@ spec:
placeholder: 公众号背面图 placeholder: 公众号背面图
validation: "url" validation: "url"
help: 图片可以从公众号后台下载物料或者自制 help: 图片可以从公众号后台下载物料或者自制
- $formkit: number
name: tagQuantity
label: 标签数量
value: -1
help: "小于 0 则展示全部标签"
- $formkit: number
name: categoryQuantity
label: 目录数量
value: -1
help: "小于 0 则展示全部目录"
- group: footer - group: footer
label: 页脚 label: 页脚

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -26,7 +26,7 @@
</div> </div>
<!-- 跳转到分类页 --> <!-- 跳转到分类页 -->
<!--<a class="category-bar-more" href="#">更多</a>--> <a class="category-bar-more" href="/categories">更多</a>
</div> </div>
</div> </div>
<div class="article-sort-title" th:text="${category.spec.displayName}"></div> <div class="article-sort-title" th:text="${category.spec.displayName}"></div>

View File

@ -19,7 +19,7 @@
<div class="recent-posts" id="recent-posts"> <div class="recent-posts" id="recent-posts">
<!-- 分类导航栏 --> <!-- 分类导航栏 -->
<div th:replace="modules/category-bar :: category-bar"></div> <div th:replace="'modules/bar/' + ${theme.config.layout.nav}"></div>
<th:block th:replace="modules/post-list :: post-list"></th:block> <th:block th:replace="modules/post-list :: post-list"></th:block>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"> <html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 目录条 --> <!-- 目录条 -->
<div id="category-bar" th:fragment="category-bar"> <div id="category-bar" th:fragment="category">
<div class="category-bar-items" id="category-bar-items"> <div class="category-bar-items" id="category-bar-items">
<div class="category-bar-item select" id="category-bar-home"> <div class="category-bar-item select" id="category-bar-home">
<a href="/">首页</a> <a href="/">首页</a>
@ -17,7 +17,7 @@
</th:block> </th:block>
</div> </div>
<a class="category-bar-more" href="categories/default">更多</a> <a th:replace="modules/bar/more :: more">更多</a>
</div> </div>
</html> </html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 目录条 -->
<div id="category-bar" th:fragment="category-bar">
<div class="category-bar-items" id="category-bar-items">
<div class="category-bar-item select" id="category-bar-home">
<a href="/">首页</a>
</div>
<th:block th:with="categoryNames = ${theme.config.layout.navCustomCategory}">
<div class="category-bar-item"
th:each="categoryName : ${categoryNames}">
<!--<a th:href="@{${categoryItem.status.permalink}}" th:text="${categoryItem.spec.displayName}"></a>-->
<a th:text="${categoryFinder.getByName(categoryName)}"></a>
</div>
</th:block>
</div>
<a th:replace="modules/bar/more :: more">更多</a>
</div>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 目录条,这里使用和 category-bar 同样的 css -->
<div id="category-bar" th:fragment="custom-tag">
<div class="category-bar-items" id="category-bar-items">
<div class="category-bar-item select" id="category-bar-home">
<a href="/">首页</a>
</div>
<th:block th:with="tags = ${theme.config.layout.navCustomTag}">
<div class="category-bar-item"
th:each="tagItem : ${tags}"
th:id="${tagItem.spec.displayName}">
<a th:href="@{${tagItem.status.permalink}}" th:text="${tagItem.spec.displayName}"></a>
</div>
</th:block>
</div>
<a th:replace="modules/bar/more :: more">更多</a>
</div>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 目录条,这里使用和 category-bar 同样的 css -->
<div id="category-bar" th:fragment="custom-tag">
<div class="category-bar-items" id="category-bar-items">
<div class="category-bar-item select" id="category-bar-home">
<a href="/">首页</a>
</div>
<th:block th:with="customUrls = ${theme.config.layout.navCustomUrl}">
<div class="category-bar-item"
th:each="customUrlItem : ${customUrls}"
th:id="${customUrlItem.title}">
<a th:href="@{${customUrlItem.url}}" th:text="${customUrlItem.title}"></a>
</div>
</th:block>
</div>
<a th:replace="modules/bar/more :: more">更多</a>
</div>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 目录条,这里使用和 category-bar 同样的 css -->
<th:block th:fragment="more">
<a class="category-bar-more" href="/categories"
th:if="${#strings.equals(theme.config.layout.navMore, 'categories') }">更多</a>
<a class="category-bar-more" href="/tags"
th:if="${#strings.equals(theme.config.layout.navMore, 'tags') }">更多</a>
<a class="category-bar-more" th:href="@{${theme.config.layout.navMoreCustomUrl}}"
th:if="${#strings.equals(theme.config.layout.navMore, 'customUrl') }">更多</a>
</th:block>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 目录条,这里使用和 category-bar 同样的 css -->
<div id="category-bar" th:fragment="tag">
<div class="category-bar-items" id="category-bar-items">
<div class="category-bar-item select" id="category-bar-home">
<a href="/">首页</a>
</div>
<th:block th:with="tags = ${tagFinder.listAll()}">
<div class="category-bar-item"
th:each="tagItem : ${tags}"
th:id="${tagItem.spec.displayName}">
<a th:href="@{${tagItem.status.permalink}}" th:text="${tagItem.spec.displayName}"></a>
</div>
</th:block>
</div>
<a th:replace="modules/bar/more :: more">更多</a>
</div>
</html>

View File

@ -52,12 +52,16 @@
</div> </div>
<div class="footer-banner-right"> <div class="footer-banner-right">
<!-- 订阅 需要 RSS 插件支持 --> <!-- 订阅 需要 RSS 插件支持 -->
<a class="footer-banner-link" href="/sitemap.xml" th:if="${pluginFinder.available('PluginSitemap')}">订阅</a> <a class="footer-banner-link" href="/sitemap.xml"
th:if="${pluginFinder.available('PluginSitemap')}">订阅</a>
<a class="footer-banner-link" href="https://github.com/liuzhihang/halo-theme-hao">主题</a> <a class="footer-banner-link" href="https://github.com/liuzhihang/halo-theme-hao">主题</a>
<a class="footer-banner-link" href="/about">关于</a> <a class="footer-banner-link" href="/about">关于</a>
<a class="footer-banner-link" href="https://beian.miit.gov.cn/#/Integrated/index" <a class="footer-banner-link" href="https://beian.miit.gov.cn/#/Integrated/index"
rel="noopener external nofollow noreferrer noopener" target="_blank">[[${theme.config.basics.icp}]] rel="noopener external nofollow noreferrer noopener" target="_blank">[[${theme.config.basics.icp}]]
</a> </a>
<a class="footer-banner-link" th:href="@{'http://www.beian.gov.cn/portal/registerSystemInfo'}"
rel="noopener external nofollow noreferrer noopener" target="_blank">[[${theme.config.basics.gongan}]]
</a>
<a class="footer-banner-link cc" <a class="footer-banner-link cc"
th:href="${theme.config.basics.copyrightAgreement}" th:href="${theme.config.basics.copyrightAgreement}"
th:if="${not #strings.isEmpty(theme.config.basics.copyrightAgreement)}" th:if="${not #strings.isEmpty(theme.config.basics.copyrightAgreement)}"

View File

@ -1,13 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"> <html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 目录 --> <!-- 目录 -->
<div class="card-widget card-categories" th:fragment="categories" th:with="categories = ${categoryFinder.listAll()}"> <div class="card-widget card-categories" th:fragment="categories"
th:with="categories = ${categoryFinder.listAll()}, categoryQuantity = ${#conversions.convert(theme.config.sidebar.categoryQuantity, 'java.lang.Integer')}">
<div class="item-headline"><i class="iconfont icon-folder-open"></i><span>分类</span></div> <div class="item-headline"><i class="iconfont icon-folder-open"></i><span>分类</span></div>
<div class="aside-list"> <div class="aside-list">
<ul class="card-category-list"> <ul class="card-category-list">
<li class="card-category-list-item" th:each="category : ${categories}"> <li class="card-category-list-item" th:each="category,iterStat : ${categories}">
<a class="card-category-list-link" th:href="@{${category.status.permalink}}"> <a class="card-category-list-link" th:href="@{${category.status.permalink}}"
<span class="card-category-list-name" th:title="${category.spec.displayName}" th:text="${category.spec.displayName}"></span> th:if="${categoryQuantity >= 0 && iterStat.index < categoryQuantity}">
<span class="card-category-list-name" th:text="${category.spec.displayName}"
th:title="${category.spec.displayName}"></span>
<span class="card-category-list-count" th:text="${category.status.postCount}"></span> <span class="card-category-list-count" th:text="${category.status.postCount}"></span>
</a> </a>
</li> </li>

View File

@ -2,12 +2,14 @@
<html lang="en" xmlns:th="http://www.thymeleaf.org"> <html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 标签 --> <!-- 标签 -->
<th:block th:fragment="tags" th:with="tags = ${tagFinder.listAll()}"> <th:block th:fragment="tags"
th:with="tags = ${tagFinder.listAll()}, tagQuantity = ${#conversions.convert(theme.config.sidebar.tagQuantity, 'java.lang.Integer')}">
<div class="item-headline"><i class="iconfont icon-tags"></i><span>标签</span></div> <div class="item-headline"><i class="iconfont icon-tags"></i><span>标签</span></div>
<div class="card-tag-cloud"> <div class="card-tag-cloud">
<a style="font-size:1em;color:#d3d3d3" th:each="tag : ${tags}" <a style="font-size:1em;color:#d3d3d3" th:each="tag,iterStat : ${tags}"
th:href="@{${tag.status.permalink}}" th:href="@{${tag.status.permalink}}"
th:if="${tagQuantity >= 0 && iterStat.index < tagQuantity}"
th:title="${tag.spec.displayName}"> th:title="${tag.spec.displayName}">
<!-- 角标 --> <!-- 角标 -->
[[${tag.spec.displayName}]]<sup th:text="${tag.status.postCount}"></sup> [[${tag.spec.displayName}]]<sup th:text="${tag.status.postCount}"></sup>

View File

@ -8,7 +8,7 @@ spec:
name: 程序员小航 name: 程序员小航
website: 'https://liuzhihang.com' website: 'https://liuzhihang.com'
description: Halo 2.0 Theme base on Thymeleaf, Referring to Butterfly and Heo description: Halo 2.0 Theme base on Thymeleaf, Referring to Butterfly and Heo
logo: 'https://liuzhihang.com/logo' logo: 'https://liuzhihang.com/themes/theme-hao/assets/images/hao-logo.jpg'
website: 'https://liuzhihang.com' website: 'https://liuzhihang.com'
repo: 'https://github.com/liuzhihang/halo-theme-hao' repo: 'https://github.com/liuzhihang/halo-theme-hao'
settingName: "theme-hao-setting" settingName: "theme-hao-setting"