From 4b318084bcf86c8ccf1f669d0eb04a4d8eaef655 Mon Sep 17 00:00:00 2001 From: Michael Hulse Date: Wed, 19 Oct 2022 22:34:18 -0700 Subject: [PATCH 1/3] :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) }} From dbcf9b3783eb66009e9e9f615e7546efff6397cc Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Tue, 8 Nov 2022 09:48:51 +1100 Subject: [PATCH 2/3] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Reorder=20params=20to?= =?UTF-8?q?=20match=20existing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/_default/params.toml | 2 +- exampleSite/config/_default/params.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index bf5dfee0..a5068884 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -51,8 +51,8 @@ enableCodeCopy = false showBreadcrumbs = false showSummary = false showTableOfContents = false - groupByYear = true showTaxonomies = false + groupByYear = true [sitemap] excludedKinds = ["taxonomy", "term"] diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 47a2f702..e0d0f42c 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -51,8 +51,8 @@ mainSections = ["samples"] showBreadcrumbs = true showSummary = false showTableOfContents = true - groupByYear = false showTaxonomies = false + groupByYear = false [sitemap] excludedKinds = ["taxonomy", "term"] From c3afeb8f2e0e32e8798d863473c4df027d087a9c Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Tue, 8 Nov 2022 09:49:06 +1100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=93=9D=20Update=20configuration=20doc?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exampleSite/content/docs/configuration.md | 39 ++++++++++++----------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/exampleSite/content/docs/configuration.md b/exampleSite/content/docs/configuration.md index 457c60ea..1731b875 100644 --- a/exampleSite/content/docs/configuration.md +++ b/exampleSite/content/docs/configuration.md @@ -47,24 +47,24 @@ Congo is optimised for full multilingual websites and theme assets are translate The theme currently supports the following languages by default: -| Language | Code | -| -------------------------------------- | ------- | -| :gb: English | `en` | -| :bangladesh: Bengali | `bn` | -| :cn: Simplified Chinese (China) | `zh-cn` | -| :taiwan: Traditional Chinese (Taiwan) | `zh-tw` | -| :finland: Finnish | `fi` | -| :fr: French | `fr` | -| :de: German | `de` | -| :israel: Hebrew | `he` | -| :hungary: Hungarian | `hu` | -| :it: Italian | `it` | -| :jp: Japanese | `ja` | -| :brazil: Portuguese (Brazil) | `pt-br` | -| :portugal: Portuguese (Portugal) | `pt-pt` | -| :romania: Romanian | `ro` | -| :es: Spanish (Spain) | `es` | -| :tr: Turkish | `tr` | +| Language | Code | +| ------------------------------------- | ------- | +| :gb: English | `en` | +| :bangladesh: Bengali | `bn` | +| :cn: Simplified Chinese (China) | `zh-cn` | +| :taiwan: Traditional Chinese (Taiwan) | `zh-tw` | +| :finland: Finnish | `fi` | +| :fr: French | `fr` | +| :de: German | `de` | +| :israel: Hebrew | `he` | +| :hungary: Hungarian | `hu` | +| :it: Italian | `it` | +| :jp: Japanese | `ja` | +| :brazil: Portuguese (Brazil) | `pt-br` | +| :portugal: Portuguese (Portugal) | `pt-pt` | +| :romania: Romanian | `ro` | +| :es: Spanish (Spain) | `es` | +| :tr: Turkish | `tr` | The default translations can be overridden by creating a custom file in `i18n/[code].yaml` that contains the translation strings. You can also use this method to add new languages. If you'd like to share a new translation with the community, please [open a pull request](https://github.com/jpanther/congo/pulls). @@ -75,7 +75,7 @@ In order to be as flexible as possible, a language configuration file needs to b The default file can be used as a template to create additional languages, or renamed if you wish to author your website in a language other than English. Simply name the file using the format `languages.[language-code].toml`. {{< alert >}} -**Note:** Ensure the `defaultContentLanguage` parameter in the [site configuration](#site-configuration) matches the language code in your language config filename. +**Note:** Ensure the `defaultContentLanguage` parameter in the [site configuration](#site-configuration) matches the language code in your language config filename. {{< /alert >}} @@ -149,6 +149,7 @@ Many of the article defaults here can be overridden on a per article basis by sp |`article.sharingLinks`|_Not set_|Which sharing links to display at the end of each article. When not provided, or set to `false` no links will be displayed.| |`list.showBreadcrumbs`|`false`|Whether or not breadcrumbs are displayed in the header on list pages.| |`list.showTableOfContents`|`false`|Whether or not the table of contents is displayed on list pages.| +|`list.showTaxonomies`|`false`|Whether or not the taxonomies related to this article are displayed on list pages.| |`list.showSummary`|`false`|Whether or not article summaries are displayed on list pages. If a summary is not provided in the [front matter]({{< ref "front-matter" >}}), one will be auto generated using the `summaryLength` parameter in the [site configuration](#site-configuration).| |`list.groupByYear`|`true`|Whether or not articles are grouped by year on list pages.| |`sitemap.excludedKinds`|`["taxonomy", "term"]`|Kinds of content that should be excluded from the generated `/sitemap.xml` file. Refer to the [Hugo docs](https://gohugo.io/templates/section-templates/#page-kinds) for acceptable values.|