From 4b318084bcf86c8ccf1f669d0eb04a4d8eaef655 Mon Sep 17 00:00:00 2001 From: Michael Hulse Date: Wed, 19 Oct 2022 22:34:18 -0700 Subject: [PATCH] :sparkles: Independent control of taxonomy display on list AND single pages Sensible defaults: `.Params` will trump article and list `showTaxonomies` settings. --- config/_default/params.toml | 1 + exampleSite/config/_default/params.toml | 1 + layouts/partials/article-meta.html | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index bcdfd4d8..bf5dfee0 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -52,6 +52,7 @@ enableCodeCopy = false showSummary = false showTableOfContents = false groupByYear = true + showTaxonomies = false [sitemap] excludedKinds = ["taxonomy", "term"] diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 07579abe..47a2f702 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -52,6 +52,7 @@ mainSections = ["samples"] showSummary = false showTableOfContents = true groupByYear = false + showTaxonomies = false [sitemap] excludedKinds = ["taxonomy", "term"] diff --git a/layouts/partials/article-meta.html b/layouts/partials/article-meta.html index 7b397796..190811ec 100644 --- a/layouts/partials/article-meta.html +++ b/layouts/partials/article-meta.html @@ -46,7 +46,10 @@ {{/* Output taxonomies */}} - {{ if .Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false) }} + {{ if or + (and (ne $scope "single") (.Params.showTaxonomies | default (.Site.Params.list.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false)))) + (and (eq $scope "single") (.Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false))) + }}
{{ range $taxonomy, $terms := .Site.Taxonomies }} {{ if (gt (len ($context.GetTerms $taxonomy)) 0) }}