From 0b15ddaa9b8e94d2f36959973f7c2405d09fed93 Mon Sep 17 00:00:00 2001 From: Sandip Bhattacharya Date: Sat, 12 Sep 2020 16:30:47 -0700 Subject: Links to tags/categories now respect permalink configuration Blog configuration can be modified to have different link permalink layout. e.g. in the `[permalinks]` section, categories can be set up in these different ways: - `categories = "/category/:slug/"` - `categories = "/categories/:slug/"` The widgets for categories and tag_cloud were hardcoding the permalinks URL. This fix will make the URL respect permalink configuration. Inspired from this hugo forum conversation: https://discourse.gohugo.io/t/how-to-get-permalink-of-taxonomies-in-templates/12927/15 --- layouts/partials/widgets/categories.html | 5 +++-- layouts/partials/widgets/tag_cloud.html | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/layouts/partials/widgets/categories.html b/layouts/partials/widgets/categories.html index 12f49fd..058e779 100644 --- a/layouts/partials/widgets/categories.html +++ b/layouts/partials/widgets/categories.html @@ -2,10 +2,11 @@

{{with .Site.Data.l10n.widgets.categories.title}}{{.}}{{end}}

diff --git a/layouts/partials/widgets/tag_cloud.html b/layouts/partials/widgets/tag_cloud.html index 21cdb8d..236dfdb 100644 --- a/layouts/partials/widgets/tag_cloud.html +++ b/layouts/partials/widgets/tag_cloud.html @@ -9,12 +9,14 @@ {{ $baseurl := .Site.BaseURL }} {{ range $name, $value := .Site.Taxonomies.tags }} {{ if (gt $value.Count $min_count) }} - + {{ with site.GetPage (printf "/%s/%s" "tags" $name) }} + {{ $name | title }} {{ end }} {{ end }} + {{ end }} -- cgit v1.2.3