feat(widgets): change widget icon or make it invisible. (#1120)

User can disable icon using `widgets.[home]page.iconVisible`,
and change widget icon using `widgets.[home]page.icon`.
This commit is contained in:
fantasime 2025-02-04 02:48:29 +08:00
parent 9e6b7b22a9
commit 787425b911
4 changed files with 20 additions and 4 deletions

View File

@ -5,7 +5,11 @@
{{- $archivesPage := index $query 0 -}} {{- $archivesPage := index $query 0 -}}
<section class="widget archives"> <section class="widget archives">
<div class="widget-icon"> <div class="widget-icon">
{{ partial "helper/icon" "infinity" }} {{ $icon := default "infinity" .Params.icon }}
{{ $iconVisible := default true .Params.iconVisible }}
{{ if $iconVisible }}
{{ partial "helper/icon" $icon }}
{{ end }}
</div> </div>
<h2 class="widget-title section-title">{{ T "widget.archives.title" }}</h2> <h2 class="widget-title section-title">{{ T "widget.archives.title" }}</h2>

View File

@ -2,7 +2,11 @@
{{- $limit := default 10 .Params.limit -}} {{- $limit := default 10 .Params.limit -}}
<section class="widget tagCloud"> <section class="widget tagCloud">
<div class="widget-icon"> <div class="widget-icon">
{{ partial "helper/icon" "categories" }} {{ $icon := default "categories" .Params.icon }}
{{ $iconVisible := default true .Params.iconVisible }}
{{ if $iconVisible }}
{{ partial "helper/icon" $icon }}
{{ end }}
</div> </div>
<h2 class="widget-title section-title">{{ T "widget.categoriesCloud.title" }}</h2> <h2 class="widget-title section-title">{{ T "widget.categoriesCloud.title" }}</h2>

View File

@ -2,7 +2,11 @@
{{- $limit := default 10 .Params.limit -}} {{- $limit := default 10 .Params.limit -}}
<section class="widget tagCloud"> <section class="widget tagCloud">
<div class="widget-icon"> <div class="widget-icon">
{{ partial "helper/icon" "tag" }} {{ $icon := default "tag" .Params.icon }}
{{ $iconVisible := default true .Params.iconVisible }}
{{ if $iconVisible }}
{{ partial "helper/icon" $icon }}
{{ end }}
</div> </div>
<h2 class="widget-title section-title">{{ T "widget.tagCloud.title" }}</h2> <h2 class="widget-title section-title">{{ T "widget.tagCloud.title" }}</h2>

View File

@ -1,7 +1,11 @@
{{ if (.Context.Scratch.Get "TOCEnabled") }} {{ if (.Context.Scratch.Get "TOCEnabled") }}
<section class="widget archives"> <section class="widget archives">
<div class="widget-icon"> <div class="widget-icon">
{{ partial "helper/icon" "hash" }} {{ $icon := default "hash" .Params.icon }}
{{ $iconVisible := default true .Params.iconVisible }}
{{ if $iconVisible }}
{{ partial "helper/icon" $icon }}
{{ end }}
</div> </div>
<h2 class="widget-title section-title">{{ T "article.tableOfContents" }}</h2> <h2 class="widget-title section-title">{{ T "article.tableOfContents" }}</h2>