Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
- id: tags_title
translation: "Tags"

- id: all_tags
translation: "All tags"

# Footer
- id: footer_credits
translation:
Expand Down
3 changes: 3 additions & 0 deletions i18n/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
- id: tags_title
translation: "Mots-clefs"

- id: all_tags
translation: "Tous les tags"

# Footer
- id: footer_credits
translation:
Expand Down
8 changes: 7 additions & 1 deletion layouts/partials/widgets/taglist.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ <h4 class="widget__title">{{ T "tags_title" }}</h4>
<div class="widget__content">
{{- 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) }}
<a class="widget-taglist__link widget__link btn" href="{{ .RelPermalink }}" title="{{ .Title }}">
{{- .Title -}}{{- if .Site.Params.widgets.tags_counter }} ({{ $taxonomy.Count }}){{ end -}}
</a>
{{- end }}
{{- end }}
{{- end }}
</div>
{{- if ge .Site.Params.widgets.tags_min_counter 2 }}
<a href="{{ "/tags/" | relURL }}">{{ T "all_tags" }}</a>
{{- end }}
</div>
{{- end }}
{{- end }}