diff --git a/exampleSite/content/home/tags.md b/exampleSite/content/home/tags.md index 56c048c0..6da5875c 100644 --- a/exampleSite/content/home/tags.md +++ b/exampleSite/content/home/tags.md @@ -9,6 +9,14 @@ title = "Popular Topics" subtitle = "" [content] + # Choose the taxonomy from `config.toml` to display (e.g. tags, categories) + taxonomy = "tags" + # Choose how many tags you would like to display (0 = all tags) count = 20 + +[design] + # Minimum and maximum font sizes (1.0 = 100%). + font_size_min = 0.7 + font_size_max = 2.0 +++ diff --git a/layouts/partials/widgets/tag_cloud.html b/layouts/partials/widgets/tag_cloud.html index af8b82ce..f8488cd9 100644 --- a/layouts/partials/widgets/tag_cloud.html +++ b/layouts/partials/widgets/tag_cloud.html @@ -1,5 +1,11 @@ +{{/* Pages Widget */}} + +{{/* Initialise */}} {{ $ := .root }} {{ $st := .page }} +{{ $taxonomy := $st.Params.content.taxonomy | default "tags" }} +{{ $fontSmall := $st.Params.design.font_size_min | default 0.8 }} +{{ $fontBig := $st.Params.design.font_size_max | default 2.5 }} {{ $items_count := $st.Params.content.count }} {{ if eq $items_count 0 }} @@ -8,6 +14,10 @@ {{ $items_count = $items_count | default 20 }} {{ end }} +{{/* Query */}} +{{ $tags := first $items_count (index site.Taxonomies $taxonomy).ByCount }} +{{ $count := len $tags }} +