Skip to content

Commit

Permalink
feat(widget): 侧边组件支持指定标题和图标
Browse files Browse the repository at this point in the history
  • Loading branch information
nineya committed Mar 21, 2024
1 parent 8762bbc commit 03381f8
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -828,17 +828,17 @@ sidebar_show:
label: 侧边栏标题
type: text
placeholder: 请输入标题内容
description: "可覆盖默认侧边栏标题。"
description: "非必填,可覆盖默认侧边栏标题。"
- name: icon
label: 侧边栏图标
type: text
placeholder: 请输入图标 class 内容
description: "可覆盖默认侧边栏图标。"
description: "非必填,可覆盖默认侧边栏图标。"
- name: content
label: 侧边栏内容
type: textarea
placeholder: 请输入 HTML 内容
description: "仅在侧边栏类型为自定义时生效。"
description: "非必填,仅在侧边栏类型为自定义时生效。"
sidebar_config:
label: 侧边栏配置
items:
Expand Down
2 changes: 1 addition & 1 deletion template/widget/categories.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<#assign postCounts = {}>
<@categoryTag method="list">
<div class="card-title">
<i class="ri-apps-line card-title-label"></i><span>分类</span>
<i class="${(sidebar.icon?? && sidebar.icon != "")?then(sidebar.icon, "ri-apps-line")} card-title-label"></i><span>${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "分类")}</span>
<#if settings.categories_more?? && settings.categories_more== true && categories?size gt num?number>
<a class="card-more" href="${categories_url!}">更多<i class="ri-arrow-right-double-line"></i></a>
</#if>
Expand Down
2 changes: 1 addition & 1 deletion template/widget/custom.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<i class="${sidebar.icon} card-title-label"></i><span>${sidebar.title}</span>
</div>
</#if>
${sidebar.content}
${sidebar.content!}
</div>
2 changes: 1 addition & 1 deletion template/widget/links.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="card widget links ${sidebar.hide!}">
<@linkTag method="listByRandom">
<div class="card-title">
<i class="ri-links-line card-title-label"></i><span>友链</span>
<i class="${(sidebar.icon?? && sidebar.icon != "")?then(sidebar.icon, "ri-links-line")} card-title-label"></i><span>${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "友链")}</span>
<#if settings.links_more?? && settings.links_more== true && links?size gt num?number>
<a class="card-more" href="${links_url!}">更多<i class="ri-arrow-right-double-line"></i></a>
</#if>
Expand Down
2 changes: 1 addition & 1 deletion template/widget/love.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="card widget love brightness ${sidebar.hide!}">
<div class="card-title">
<i class="ri-heart-fill card-title-label"></i><span>恋爱墙</span>
<i class="${(sidebar.icon?? && sidebar.icon != "")?then(sidebar.icon, "ri-heart-fill")} card-title-label"></i><span>${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "恋爱墙")}</span>
</div>
<div class="card-content">
<div class="love-content">
Expand Down
2 changes: 1 addition & 1 deletion template/widget/music.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<#assign sidebar_music = true>
<div class="card widget music ${sidebar.hide!}">
<div class="card-title">
<i class="ri-music-2-line card-title-label"></i><span>音乐</span>
<i class="${(sidebar.icon?? && sidebar.icon != "")?then(sidebar.icon, "ri-music-2-line")} card-title-label"></i><span>${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "音乐")}</span>
</div>
<div style="min-height: 90px;margin-top: -0.5rem;">
<#if (settings.music_mode!'playlist') == 'playlist'>
Expand Down
2 changes: 1 addition & 1 deletion template/widget/notice.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="card widget notice ${sidebar.hide!} is-hidden-all">
<div class="card-title">
<i class="ri-volume-up-line card-title-label"></i><span>公告</span>
<i class="${(sidebar.icon?? && sidebar.icon != "")?then(sidebar.icon, "ri-volume-up-line")} card-title-label"></i><span>${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "公告")}</span>
</div>
<div class="card-content">
<div>${settings.notice_content!'<p>&emsp;&emsp;欢迎来访${blog_title!},博主还没有发布任何公告!</p>'}</div>
Expand Down
2 changes: 1 addition & 1 deletion template/widget/recent_comments.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="card widget recent-comments ${sidebar.hide!}">
<div class="card-title">
<i class="ri-message-2-line card-title-label"></i><span>最新评论</span>
<i class="${(sidebar.icon?? && sidebar.icon != "")?then(sidebar.icon, "ri-message-2-line")} card-title-label"></i><span>${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "最新评论")}</span>
</div>
<@commentTag method="latest" top="${settings.recent_comments_num!5}">
<#if comments.content?size gt 0>
Expand Down
2 changes: 1 addition & 1 deletion template/widget/recent_posts.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="card widget recent-posts ${sidebar.hide!}">
<div class="card-title">
<i class="ri-history-line card-title-label"></i><span>最新文章</span>
<i class="${(sidebar.icon?? && sidebar.icon != "")?then(sidebar.icon, "ri-history-line")} card-title-label"></i><span>${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "最新文章")}</span>
</div>
<@postTag method="latest" top="${settings.recent_posts_num!5}">
<#if posts?size gt 0>
Expand Down
2 changes: 1 addition & 1 deletion template/widget/tagcloud.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="card widget tagcloud ${sidebar.hide!}">
<@tagTag method="list">
<div class="card-title">
<i class="ri-cloud-line card-title-label"></i><span>标签云</span>
<i class="${(sidebar.icon?? && sidebar.icon != "")?then(sidebar.icon, "ri-cloud-line")} card-title-label"></i><span>${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "标签云")}</span>
<#if settings.tagcloud_more?? && settings.tagcloud_more== true && tags?size gt num?number>
<a class="card-more" href="${tags_url!}">更多<i class="ri-arrow-right-double-line"></i></a>
</#if>
Expand Down
2 changes: 1 addition & 1 deletion template/widget/tags.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="card widget tags ${sidebar.hide!}">
<@tagTag method="list">
<div class="card-title">
<i class="ri-price-tag-3-line card-title-label"></i><span>标签</span>
<i class="${(sidebar.icon?? && sidebar.icon != "")?then(sidebar.icon, "ri-price-tag-3-line")} card-title-label"></i><span>${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "标签")}</span>
<#if settings.tags_more?? && settings.tags_more== true && tags?size gt num?number>
<a class="card-more" href="${tags_url!}">更多<i class="ri-arrow-right-double-line"></i></a>
</#if>
Expand Down
2 changes: 1 addition & 1 deletion template/widget/toc.ftl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<#assign sidebar_toc = true>
<div class="card widget toc ${sidebar.hide!} is-hidden-all">
<div class="card-title">
<i class="ri-book-2-line card-title-label"></i><span>目录</span>
<i class="${(sidebar.icon?? && sidebar.icon != "")?then(sidebar.icon, "ri-book-2-line")} card-title-label"></i><span>${(sidebar.title?? && sidebar.title != "")?then(sidebar.title, "目录")}</span>
</div>
<div class="card-content toc-content">
</div>
Expand Down

0 comments on commit 03381f8

Please sign in to comment.