新增自定义侧边栏模块

移除原有公告内容输入框,改为侧边栏组中输入内容
This commit is contained in:
j m 2024-04-28 21:06:18 +08:00
parent 16cc75ac38
commit 440ed26527
16 changed files with 79 additions and 50 deletions

View File

@ -646,6 +646,8 @@ spec:
label: 人生倒计时 label: 人生倒计时
- value: 'wechat' - value: 'wechat'
label: 微信公众号 label: 微信公众号
- value: 'custom'
label: 自定义模块
- $formkit: select - $formkit: select
name: position name: position
label: 模块位置 label: 模块位置
@ -670,6 +672,23 @@ spec:
label: 桌面设备隐藏 label: 桌面设备隐藏
- value: 'is-not-hidden' - value: 'is-not-hidden'
label: 不隐藏 label: 不隐藏
- $formkit: text
name: title
label: 侧边栏标题
placeholder: '请输入标题内容'
help: '非必填,可覆盖默认侧边栏标题。'
- $formkit: text
name: icon
label: 侧边栏图标
placeholder: '请输入图标 class 内容'
help: '非必填,可覆盖默认侧边栏图标。'
- $formkit: code
name: content
language: html
height: 100px
label: 侧边栏内容
placeholder: 请输入 HTML 内容
help: '非必填,仅在侧边栏类型为公告、自定义时生效。'
- $formkit: radio - $formkit: radio
name: enable_color_character name: enable_color_character
label: 侧边栏信息-开启彩字切换 label: 侧边栏信息-开启彩字切换
@ -746,13 +765,6 @@ spec:
name: url name: url
label: 地址 label: 地址
value: "" value: ""
- $formkit: code
name: notice_content
label: 侧边栏公告-博客公告
placeholder: 请输入公告内容
language: html
height: 240px
help: 公告内容支持 HTML 标签。
- $formkit: radio - $formkit: radio
name: notice_show_mode name: notice_show_mode
label: 侧边栏公告-显示模式 label: 侧边栏公告-显示模式
@ -1423,8 +1435,8 @@ spec:
if: $get(enable_security_link).value if: $get(enable_security_link).value
validation: required validation: required
label: 安全链接页面-跳转提示区域文本描述 label: 安全链接页面-跳转提示区域文本描述
height: 240px
language: html language: html
height: 240px
value: '您即将离开<span>{title}</span>,去往:<span>{url}</span>' value: '您即将离开<span>{title}</span>,去往:<span>{url}</span>'
placeholder: '请输入安全链接页面跳转提示区域的文本描述' placeholder: '请输入安全链接页面跳转提示区域的文本描述'
help: '"<span></span>"包裹时字体颜色为主题色,“ {title} ”表示站点主标题,“ {url} ”表示跳转URL区分大小写。默认值“您即将离开<span>{title}</span>,去往:<span>{url}</span>”' help: '"<span></span>"包裹时字体颜色为主题色,“ {title} ”表示站点主标题,“ {url} ”表示跳转URL区分大小写。默认值“您即将离开<span>{title}</span>,去往:<span>{url}</span>”'
@ -1434,29 +1446,40 @@ spec:
- $formkit: text - $formkit: text
name: external_css name: external_css
label: "外部 CSS 链接" label: "外部 CSS 链接"
language: css
placeholder: 请输入 CSS 文件链接 placeholder: 请输入 CSS 文件链接
help: "填入外部CSS链接无需link标签将插入head标签尾部。" help: "填入外部CSS链接无需link标签将插入head标签尾部。"
- $formkit: code - $formkit: code
name: inline_css name: inline_css
language: css
height: 240px
label: "内嵌 CSS" label: "内嵌 CSS"
placeholder: 请输入 CSS 样式内容 placeholder: 请输入 CSS 样式内容
help: '填入CSS代码无需style标签将插入head标签尾部。' help: '填入CSS代码无需style标签将插入head标签尾部。'
- $formkit: code - $formkit: code
name: external_js_head name: external_js_head
language: javascript
height: 240px
label: "外部 JS 链接head" label: "外部 JS 链接head"
placeholder: 请输入 script 标签 placeholder: 请输入 script 标签
help: '填入外部JS链接需要script标签可按情况指定async和defer属性将插入head标签尾部。' help: '填入外部JS链接需要script标签可按情况指定async和defer属性将插入head标签尾部。'
- $formkit: code - $formkit: code
name: inline_js_head name: inline_js_head
language: javascript
height: 240px
label: "内嵌 JShead" label: "内嵌 JShead"
placeholder: 请输入 JS 代码内容 placeholder: 请输入 JS 代码内容
help: '填入JS代码无需script标签将插入head标签尾部。' help: '填入JS代码无需script标签将插入head标签尾部。'
- $formkit: code - $formkit: code
name: external_js_body name: external_js_body
language: javascript
height: 240px
label: "外部 JS 链接body" label: "外部 JS 链接body"
placeholder: 请输入 script 标签 placeholder: 请输入 script 标签
help: '填入外部JS链接需要script标签可按情况指定async和defer属性将插入body标签尾部。' help: '填入外部JS链接需要script标签可按情况指定async和defer属性将插入body标签尾部。'
- $formkit: code - $formkit: code
language: javascript
height: 240px
name: inline_js_body name: inline_js_body
label: "内嵌JSbody" label: "内嵌JSbody"
placeholder: 请输入 JS 代码内容 placeholder: 请输入 JS 代码内容

View File

@ -3,7 +3,7 @@
th:class="'column column-side column-' + ${position} + ' ' + ${position == 'left'?theme.config.basic_style.left_sidebar_sticky:theme.config.basic_style.right_sidebar_sticky} + '-sticky'"> th:class="'column column-side column-' + ${position} + ' ' + ${position == 'left'?theme.config.basic_style.left_sidebar_sticky:theme.config.basic_style.right_sidebar_sticky} + '-sticky'">
<th:block th:each="sidebar :${theme.config.sidebar.sidebar_show}"> <th:block th:each="sidebar :${theme.config.sidebar.sidebar_show}">
<th:block th:if="${sidebar.position == position}"> <th:block th:if="${sidebar.position == position}">
<th:block th:replace="~{${'/widget/' + sidebar.type} :: widget ( hide = ${sidebar.hide})}" /> <th:block th:replace="~{${'/widget/' + sidebar.type} :: widget ( sidebar = ${sidebar})}" />
</th:block> </th:block>
</th:block> </th:block>
<div th:if="${position == 'left'}" class="column-right-shadow is-hidden-desktop"> <div th:if="${position == 'left'}" class="column-right-shadow is-hidden-desktop">

View File

@ -1,6 +1,6 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget ' + ${hide}"> th:class="'card widget ' + ${sidebar.hide}">
<a th:if="${theme.config.sidebar.ad_mode}" target="_blank" th:href="${theme.config.sidebar.ad_target_url}"> <a th:if="${theme.config.sidebar.ad_mode}" target="_blank" th:href="${theme.config.sidebar.ad_target_url}">
<img width="100%" th:src="${theme.config.sidebar.ad_image}" alt="广告"/> <img width="100%" th:src="${theme.config.sidebar.ad_image}" alt="广告"/>
</a> </a>

View File

@ -1,11 +1,11 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget ' + ${hide}" th:class="'card widget ' + ${sidebar.hide}"
th:with="num = ${#strings.isEmpty(theme.config.sidebar.categories_num)? 10 : T(java.lang.Integer).parseInt(theme.config.sidebar.categories_num)}, th:with="num = ${#strings.isEmpty(theme.config.sidebar.categories_num)? 10 : T(java.lang.Integer).parseInt(theme.config.sidebar.categories_num)},
categories = ${categoryFinder.listAsTree()}, categories = ${categoryFinder.listAsTree()},
isEmpty = ${#lists.isEmpty(categories)}"> isEmpty = ${#lists.isEmpty(categories)}">
<div class="card-title"> <div class="card-title">
<i class="ri-apps-line card-title-label"></i><span>分类</span> <i th:class="${#strings.defaultString(sidebar.icon, 'ri-apps-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '分类')}"></span>
<a th:if="${theme.config.sidebar.categories_more}" class="card-more" th:href="@{/categories}">更多<i <a th:if="${theme.config.sidebar.categories_more}" class="card-more" th:href="@{/categories}">更多<i
class="ri-arrow-right-double-line"></i></a> class="ri-arrow-right-double-line"></i></a>
</div> </div>

View File

@ -0,0 +1,8 @@
<div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (sidebar)"
th:class="'card widget ' + ${sidebar.hide}">
<div class="card-title" th:if="${!#strings.isEmpty(sidebar.title) && !#strings.isEmpty(sidebar.icon)}">
<i th:class="${sidebar.icon + ' card-title-label'}"></i><span th:text="${sidebar.title}"></span>
</div>
[(${sidebar.content})]
</div>

View File

@ -1,8 +1,8 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget love brightness ' + ${hide}"> th:class="'card widget love brightness ' + ${sidebar.hide}">
<div class="card-title"> <div class="card-title">
<i class="ri-heart-fill card-title-label"></i><span>恋爱墙</span> <i th:class="${#strings.defaultString(sidebar.icon, 'ri-heart-fill') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '恋爱墙')}"></span>
</div> </div>
<div class="card-content"> <div class="card-content">
<div class="love-content"> <div class="love-content">

View File

@ -1,8 +1,8 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget music ' + ${hide}"> th:class="'card widget music ' + ${sidebar.hide}">
<div class="card-title"> <div class="card-title">
<i class="ri-music-2-line card-title-label"></i><span>音乐</span> <i th:class="${#strings.defaultString(sidebar.icon, 'ri-music-2-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '音乐')}"></span>
</div> </div>
<div style="min-height: 90px;margin-top: -0.5rem;"> <div style="min-height: 90px;margin-top: -0.5rem;">
<meting-js th:if="${theme.config.sidebar.music_mode == 'playlist'}" list-folded="true" server="netease" <meting-js th:if="${theme.config.sidebar.music_mode == 'playlist'}" list-folded="true" server="netease"

View File

@ -1,10 +1,10 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget notice ' + ${hide} + ' is-hidden-all'"> th:class="'card widget notice ' + ${sidebar.hide} + ' is-hidden-all'">
<div class="card-title"> <div class="card-title">
<i class="ri-volume-up-line card-title-label"></i><span>公告</span> <i th:class="${#strings.defaultString(sidebar.icon, 'ri-volume-up-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '公告')}"></span>
</div> </div>
<div class="card-content"> <div class="card-content custom-notice-content">
<div th:utext="${#strings.isEmpty(theme.config.sidebar.notice_content)? '<p>&emsp;&emsp;欢迎来访' + site.title + ',博主还没有发布任何公告!</p>' : theme.config.sidebar.notice_content}"></div> <div th:utext="${#strings.isEmpty(sidebar.content)? '<p>&emsp;&emsp;欢迎来访' + site.title + ',博主还没有发布任何公告!</p>' : sidebar.content}"></div>
</div> </div>
</div> </div>

View File

@ -1,6 +1,6 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget profile ' + ${hide}"> th:class="'card widget profile ' + ${sidebar.hide}">
<div class="card-content"> <div class="card-content">
<nav class="level"> <nav class="level">
<div class="level-item" style="flex-direction: column;"> <div class="level-item" style="flex-direction: column;">

View File

@ -1,9 +1,9 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget recent-comments ' + ${hide}" th:class="'card widget recent-comments ' + ${sidebar.hide}"
th:with="num = ${#strings.isEmpty(theme.config.sidebar.recent_comments_num)? 5 : T(java.lang.Integer).parseInt(theme.config.sidebar.recent_comments_num)}, comments = ${commentFinder.list(null,1,num)}, isEmpty = ${#lists.isEmpty(comments)}"> th:with="num = ${#strings.isEmpty(theme.config.sidebar.recent_comments_num)? 5 : T(java.lang.Integer).parseInt(theme.config.sidebar.recent_comments_num)}, comments = ${commentFinder.list(null,1,num)}, isEmpty = ${#lists.isEmpty(comments)}">
<div class="card-title"> <div class="card-title">
<i class="ri-history-line card-title-label"></i><span>最新评论</span> <i th:class="${#strings.defaultString(sidebar.icon, 'ri-message-2-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '最新评论')}"></span>
</div> </div>
<div th:if="${isEmpty}" class="card-empty">暂无评论</div> <div th:if="${isEmpty}" class="card-empty">暂无评论</div>
<div th:unless="${isEmpty}" class="card-content"> <div th:unless="${isEmpty}" class="card-content">

View File

@ -1,9 +1,9 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget recent-posts ' + ${hide}" th:class="'card widget recent-posts ' + ${sidebar.hide}"
th:with="num = ${#strings.isEmpty(theme.config.sidebar.recent_posts_num)? 5 : T(java.lang.Integer).parseInt(theme.config.sidebar.recent_posts_num)}, posts = ${postFinder.list(1,num)}, isEmpty = ${#lists.isEmpty(posts)}"> th:with="num = ${#strings.isEmpty(theme.config.sidebar.recent_posts_num)? 5 : T(java.lang.Integer).parseInt(theme.config.sidebar.recent_posts_num)}, posts = ${postFinder.list(1,num)}, isEmpty = ${#lists.isEmpty(posts)}">
<div class="card-title"> <div class="card-title">
<i class="ri-history-line card-title-label"></i><span>最新文章</span> <i th:class="${#strings.defaultString(sidebar.icon, 'ri-history-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '最新文章')}"></span>
<a th:if="${theme.config.sidebar.recent_posts_more}" class="card-more" th:href="@{/archives}">更多<i class="ri-arrow-right-double-line"></i></a> <a th:if="${theme.config.sidebar.recent_posts_more}" class="card-more" th:href="@{/archives}">更多<i class="ri-arrow-right-double-line"></i></a>
</div> </div>
<div th:if="${isEmpty}" class="card-empty">暂无文章</div> <div th:if="${isEmpty}" class="card-empty">暂无文章</div>

View File

@ -1,14 +1,13 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget tagcloud ' + ${hide}" th:class="'card widget tagcloud ' + ${sidebar.hide}"
th:with="num = ${#strings.isEmpty(theme.config.sidebar.tags_num)? 32 : T(java.lang.Integer).parseInt(theme.config.sidebar.tags_num)}, th:with="num = ${#strings.isEmpty(theme.config.sidebar.tags_num)? 32 : T(java.lang.Integer).parseInt(theme.config.sidebar.tags_num)},
tags = ${tagFinder.list(1,num)}, tags = ${tagFinder.list(1,num)},
isEmpty = ${#lists.isEmpty(tags)}, isEmpty = ${#lists.isEmpty(tags)},
enableTagsColor = ${theme.config.sidebar.enable_tagcloud_color}, enableTagsColor = ${theme.config.sidebar.enable_tagcloud_color}">
showTagCloudStyle = ${theme.config.sidebar.show_tagcloud_style}">
<div class="card-title"> <div class="card-title">
<i class="ri-cloud-line card-title-label"></i><span>标签云</span> <i th:class="${#strings.defaultString(sidebar.icon, 'ri-cloud-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '标签云')}"></span>
<a th:if="${theme.config.sidebar.tagcloud_more}" class="card-more" th:href="@{/tags}">更多<i class="ri-arrow-right-double-line"></i></a> <a th:if="${theme.config.sidebar.tagcloud_more}" class="card-more" th:href="@{/tags}">更多<i class="ri-arrow-right-double-line"></i></a>
</div> </div>
<div th:if="${isEmpty}" class="card-empty">暂无标签</div> <div th:if="${isEmpty}" class="card-empty">暂无标签</div>

View File

@ -1,12 +1,12 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget tags ' + ${hide}" th:class="'card widget tags ' + ${sidebar.hide}"
th:with="num = ${#strings.isEmpty(theme.config.sidebar.tags_num)? 18 : T(java.lang.Integer).parseInt(theme.config.sidebar.tags_num)}, th:with="num = ${#strings.isEmpty(theme.config.sidebar.tags_num)? 18 : T(java.lang.Integer).parseInt(theme.config.sidebar.tags_num)},
tags = ${tagFinder.list(1,num)}, tags = ${tagFinder.list(1,num)},
isEmpty = ${#lists.isEmpty(tags)}, isEmpty = ${#lists.isEmpty(tags)},
enableTagsColor = ${theme.config.sidebar.enable_tag_color}"> enableTagsColor = ${theme.config.sidebar.enable_tag_color}">
<div class="card-title"> <div class="card-title">
<i class="ri-price-tag-3-line card-title-label"></i><span>标签</span> <i th:class="${#strings.defaultString(sidebar.icon, 'ri-price-tag-3-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '标签')}"></span>
<a th:if="${theme.config.sidebar.tags_more}" class="card-more" th:href="@{/tags}">更多<i class="ri-arrow-right-double-line"></i></a> <a th:if="${theme.config.sidebar.tags_more}" class="card-more" th:href="@{/tags}">更多<i class="ri-arrow-right-double-line"></i></a>
</div> </div>
<div th:if="${isEmpty}" class="card-empty">暂无标签</div> <div th:if="${isEmpty}" class="card-empty">暂无标签</div>

View File

@ -1,10 +1,9 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget timelife ' + ${hide}"> th:class="'card widget timelife ' + ${sidebar.hide}">
<div class="card-title"> <div class="card-title">
<i class="ri-hourglass-line card-title-label"></i> <i th:class="${#strings.defaultString(sidebar.icon, 'ri-hourglass-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '人生倒计时')}"></span>
<span>人生倒计时</span>
</div> </div>
<div class="card-content aside-timelife"></div> <div class="card-content aside-timelife"></div>
</div> </div>

View File

@ -1,8 +1,8 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget toc ' + ${hide} + ' is-hidden-all'"> th:class="'card widget toc ' + ${sidebar.hide} + ' is-hidden-all'">
<div class="card-title"> <div class="card-title">
<i class="ri-book-2-line card-title-label"></i><span>目录</span> <i th:class="${#strings.defaultString(sidebar.icon, 'ri-book-2-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '目录')}"></span>
</div> </div>
<div class="card-content toc-content"> <div class="card-content toc-content">
</div> </div>

View File

@ -1,6 +1,6 @@
<div xmlns:th="https://www.thymeleaf.org" <div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (hide)" th:fragment="widget (sidebar)"
th:class="'card widget wechat ' + ${hide}" th:class="'card widget wechat ' + ${sidebar.hide}"
th:with="faceImg = ${theme.config.sidebar.wechat.wechat_img_face}, th:with="faceImg = ${theme.config.sidebar.wechat.wechat_img_face},
backImg = ${theme.config.sidebar.wechat.wechat_img_back}, backImg = ${theme.config.sidebar.wechat.wechat_img_back},
wechatUrl = ${theme.config.sidebar.wechat.wechat_url}"> wechatUrl = ${theme.config.sidebar.wechat.wechat_url}">