diff --git a/README.md b/README.md index 12d95511..82cbc96d 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ googleAnalytics = "" # Enable Google Analytics by entering your tracking id [Params.widgets] recent_num = 5 # Set the number of articles in the "Recent articles" widget tags_counter = false # Enable counter for each tag in "Tags" widget + tags_min_counter = 1 # Display only tags with a greater value [Params.widgets.social] # Enable parts of social widget diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 370ab4c6..8eb9efb4 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -33,3 +33,4 @@ googleAnalytics = "" # Enable Google Analytics by entering your tracking id [Params.widgets] recent_num = 5 # Set the number of articles in the "Recent articles" widget tags_counter = false # Enable counter for each tag in "Tags" widget (disabled by default) + tags_min_counter = 5 # Display only tags with greateror equal counter, to limit tag list diff --git a/i18n/en.yaml b/i18n/en.yaml index 3614cf05..95c464de 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -61,6 +61,9 @@ - id: tags_title translation: "Tags" +- id: all_tags + translation: "All tags" + # Footer - id: footer_credits translation: diff --git a/i18n/fr.yaml b/i18n/fr.yaml index 07963dbf..e90713e9 100644 --- a/i18n/fr.yaml +++ b/i18n/fr.yaml @@ -61,6 +61,9 @@ - id: tags_title translation: "Mots-clefs" +- id: all_tags + translation: "Tous les tags" + # Footer - id: footer_credits translation: diff --git a/layouts/partials/widgets/taglist.html b/layouts/partials/widgets/taglist.html index 4c51b04b..a9c36f30 100644 --- a/layouts/partials/widgets/taglist.html +++ b/layouts/partials/widgets/taglist.html @@ -5,11 +5,17 @@

{{ T "tags_title" }}

{{- range $name, $taxonomy := $tags }} {{- with $.Site.GetPage (printf "/tags/%s" $name) }} + {{/* Only render tags with a counter value greater than minimal settings */}} + {{- if ge $taxonomy.Count (default 0 .Site.Params.widgets.tags_min_counter) }} {{- .Title -}}{{- if .Site.Params.widgets.tags_counter }} ({{ $taxonomy.Count }}){{ end -}} {{- end }} + {{- end }} {{- end }}
+ {{- if ge .Site.Params.widgets.tags_min_counter 2 }} + {{ T "all_tags" }} + {{- end }} -{{- end }} \ No newline at end of file +{{- end }}