From 787425b91122acba777c25481cbe4eaa3e692a05 Mon Sep 17 00:00:00 2001 From: fantasime Date: Tue, 4 Feb 2025 02:48:29 +0800 Subject: [PATCH] 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`. --- layouts/partials/widget/archives.html | 6 +++++- layouts/partials/widget/categories.html | 6 +++++- layouts/partials/widget/tag-cloud.html | 6 +++++- layouts/partials/widget/toc.html | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/layouts/partials/widget/archives.html b/layouts/partials/widget/archives.html index 1f2abc5..79755f7 100644 --- a/layouts/partials/widget/archives.html +++ b/layouts/partials/widget/archives.html @@ -5,7 +5,11 @@ {{- $archivesPage := index $query 0 -}}
- {{ partial "helper/icon" "infinity" }} + {{ $icon := default "infinity" .Params.icon }} + {{ $iconVisible := default true .Params.iconVisible }} + {{ if $iconVisible }} + {{ partial "helper/icon" $icon }} + {{ end }}

{{ T "widget.archives.title" }}

diff --git a/layouts/partials/widget/categories.html b/layouts/partials/widget/categories.html index 10c8a35..746c252 100644 --- a/layouts/partials/widget/categories.html +++ b/layouts/partials/widget/categories.html @@ -2,7 +2,11 @@ {{- $limit := default 10 .Params.limit -}}
- {{ partial "helper/icon" "categories" }} + {{ $icon := default "categories" .Params.icon }} + {{ $iconVisible := default true .Params.iconVisible }} + {{ if $iconVisible }} + {{ partial "helper/icon" $icon }} + {{ end }}

{{ T "widget.categoriesCloud.title" }}

diff --git a/layouts/partials/widget/tag-cloud.html b/layouts/partials/widget/tag-cloud.html index e64e5e2..87ae35d 100644 --- a/layouts/partials/widget/tag-cloud.html +++ b/layouts/partials/widget/tag-cloud.html @@ -2,7 +2,11 @@ {{- $limit := default 10 .Params.limit -}}
- {{ partial "helper/icon" "tag" }} + {{ $icon := default "tag" .Params.icon }} + {{ $iconVisible := default true .Params.iconVisible }} + {{ if $iconVisible }} + {{ partial "helper/icon" $icon }} + {{ end }}

{{ T "widget.tagCloud.title" }}

diff --git a/layouts/partials/widget/toc.html b/layouts/partials/widget/toc.html index e311de3..d675aa0 100644 --- a/layouts/partials/widget/toc.html +++ b/layouts/partials/widget/toc.html @@ -1,7 +1,11 @@ {{ if (.Context.Scratch.Get "TOCEnabled") }}
- {{ partial "helper/icon" "hash" }} + {{ $icon := default "hash" .Params.icon }} + {{ $iconVisible := default true .Params.iconVisible }} + {{ if $iconVisible }} + {{ partial "helper/icon" $icon }} + {{ end }}

{{ T "article.tableOfContents" }}