Skip to content

Commit 4810963

Browse files
committed
feat: Implement optional title linking for taxonomy widgets and enable parameter customization for taxonomy partials.
1 parent 1a32887 commit 4810963

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
1-
{{ partial "widget/taxonomy" (dict
2-
"Context" .Context
3-
"Params" (dict
4-
"taxonomy" "categories"
5-
"title" (T "widget.categoriesCloud.title")
6-
"icon" "categories"
7-
)
8-
) }}
1+
{{ $params := merge (dict "taxonomy" "categories" "title" (T "widget.categoriesCloud.title") "icon" "categories") .Params }}
2+
{{ partial "widget/taxonomy" (dict "Context" .Context "Params" $params) }}
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
1-
{{ partial "widget/taxonomy" (dict
2-
"Context" .Context
3-
"Params" (dict
4-
"taxonomy" "tags"
5-
"title" (T "widget.tagCloud.title")
6-
"icon" "tag"
7-
)
8-
) }}
1+
{{ $params := merge (dict "taxonomy" "tags" "title" (T "widget.tagCloud.title") "icon" "tag") .Params }}
2+
{{ partial "widget/taxonomy" (dict "Context" .Context "Params" $params) }}

layouts/_partials/widget/taxonomy.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,21 @@
88

99
{{- $limit := default 10 .Params.limit -}}
1010
{{- $icon := default .Params.taxonomy .Params.icon -}}
11+
{{- $showLink := default false .Params.showLink -}}
1112

1213
<section class="widget tagCloud">
1314
<div class="widget-icon">
1415
{{ partial "helper/icon" $icon }}
1516
</div>
16-
<h2 class="widget-title section-title">{{ default .Params.title $taxonomyPage.Title }}</h2>
17+
<h2 class="widget-title section-title">
18+
{{ if $showLink }}
19+
<a href="{{ $taxonomyPage.RelPermalink }}">
20+
{{ default .Params.title $taxonomyPage.Title }}
21+
</a>
22+
{{ else }}
23+
{{ default .Params.title $taxonomyPage.Title }}
24+
{{ end }}
25+
</h2>
1726

1827
<div class="tagCloud-tags">
1928
{{ range first $limit $taxonomy.ByCount }}

0 commit comments

Comments
 (0)