Merge pull request #32 from liuzhihang/dev

支持自定义导航栏
This commit is contained in:
liuzhihang 2022-12-13 00:15:31 +08:00 committed by GitHub
commit bf012e2b75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 37 deletions

View File

@ -1,6 +1,6 @@
{
"name": "halo-theme-hao",
"version": "1.0.2",
"version": "1.0.3",
"dependencies": {
}
}

View File

@ -190,30 +190,30 @@ spec:
value: category
- label: 标签
value: tag
# - label: 自定义分类
# value: custom-category
# - label: 自定义标签
# value: custom-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-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
@ -439,9 +439,9 @@ spec:
help: "小于 0 则展示全部标签"
- $formkit: number
name: categoryQuantity
label: 目录数量
label: 分类数量
value: -1
help: "小于 0 则展示全部目录"
help: "小于 0 则展示全部分类"
- group: footer
label: 页脚

View File

@ -1,21 +1,20 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 目录条 -->
<div id="category-bar" th:fragment="category-bar">
<div id="category-bar" th:fragment="custom-category">
<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}">
<th:block th:each="customCategory : ${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>
th:each="categoryItem : ${categoryFinder.getByName(customCategory.category)}"
th:id="${categoryItem.spec.displayName}">
<a th:href="@{${categoryItem.status.permalink}}" th:text="${categoryItem.spec.displayName}"></a>
</div>
</th:block>
</div>
<a th:replace="modules/bar/more :: more">更多</a>
</div>

View File

@ -7,15 +7,14 @@
<a href="/">首页</a>
</div>
<th:block th:with="tags = ${theme.config.layout.navCustomTag}">
<th:block th:each="customTag : ${theme.config.layout.navCustomTag}">
<div class="category-bar-item"
th:each="tagItem : ${tags}"
th:each="tagItem : ${tagFinder.getByName(customTag.tag)}"
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>

View File

@ -13,5 +13,5 @@ spec:
repo: 'https://github.com/liuzhihang/halo-theme-hao'
settingName: "theme-hao-setting"
configMapName: "theme-hao-configMap"
version: 1.0.2
version: 1.0.3
require: 2.0.0