From 50c5d212de9cb1e8797c403c4346166d6581a9c5 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Thu, 25 May 2023 14:12:42 +1000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Support=20new=20language=20param?= =?UTF-8?q?s=20changes=20in=20Hugo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ config/_default/languages.en.toml | 13 +++++++------ exampleSite/config/_default/languages.en.toml | 13 +++++++------ exampleSite/content/docs/configuration/index.md | 12 ++++++------ layouts/_default/index.json | 2 +- layouts/partials/functions/date.html | 2 +- layouts/partials/head.html | 2 +- layouts/partials/translations.html | 4 ++-- 8 files changed, 27 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8874b86..1ba783ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Added +- Support for Hugo v0.112.0 - Ability to specify an alternate logo image when dark appearance is active ([#533], ([#521](https://github.com/jpanther/congo/pull/521))(https://github.com/jpanther/congo/pull/533), [#543](https://github.com/jpanther/congo/pull/543)) - Ability to specify the hashing algorithm that is used when fingerprinting assets ([#478](https://github.com/jpanther/congo/issues/478)) - Arabic translation ([#521](https://github.com/jpanther/congo/pull/521)) @@ -16,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed +- ⚠️ Some parameters in the root of the Languages config file have been nested under the `params` block - Search results now respect `showDate` value when displaying article metadata ([#511](https://github.com/jpanther/congo/pull/511)) - Adopted new Tailwind logical properties for RTL styling - Updated Dutch translation ([#544](https://github.com/jpanther/congo/pull/544)) diff --git a/config/_default/languages.en.toml b/config/_default/languages.en.toml index 5c1e8a8c..2c01eb6d 100644 --- a/config/_default/languages.en.toml +++ b/config/_default/languages.en.toml @@ -1,18 +1,19 @@ languageCode = "en" languageName = "English" -displayName = "EN" -isoCode = "en" weight = 1 -rtl = false title = "Congo" -# description = "My awesome website" # copyright = "Copy, _right?_ :thinking_face:" -dateFormat = "2 January 2006" - [params] + isoCode = "en" + displayName = "EN" + rtl = false + + dateFormat = "2 January 2006" + # mainSections = ["section1", "section2"] + # description = "My awesome website" [author] # name = "Your name here" diff --git a/exampleSite/config/_default/languages.en.toml b/exampleSite/config/_default/languages.en.toml index 3ace9ffb..2d4e6a2d 100644 --- a/exampleSite/config/_default/languages.en.toml +++ b/exampleSite/config/_default/languages.en.toml @@ -1,18 +1,19 @@ languageCode = "en-au" languageName = "English (Australia)" -displayName = ":flag-au:" -isoCode = "en-AU" weight = 1 -rtl = false title = "Congo" -description = "A powerful, lightweight theme for Hugo built with Tailwind CSS." copyright = "© 2023 Congo contributors" -dateFormat = "2 January 2006" - [params] + isoCode = "en-AU" + displayName = ":flag-au:" + rtl = false + + dateFormat = "2 January 2006" + mainSections = ["samples"] + description = "A powerful, lightweight theme for Hugo built with Tailwind CSS." [author] name = "Congo" diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index 47e145fb..8bb275ca 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -89,17 +89,17 @@ The default file can be used as a template to create additional languages, or re |Name|Default|Description| |---|---|---| -|`languageCode`|`"en"`|The Hugo language code for this file. It can be a top-level language (ie. `en`) or a sub-variant (ie. `en-au`) and should match the language code in the filename. Hugo expects this value to always be in lowercase. For proper HTML compliance, set the `isoCode` parameter which is case-sensitive.| +|`languageCode`|`"en"`|The Hugo language code for this file. It can be a top-level language (ie. `en`) or a sub-variant (ie. `en-au`) and should match the language code in the filename. Hugo expects this value to always be in lowercase. For proper HTML compliance, set the `params.isoCode` parameter which is case-sensitive.| |`languageName`|`"English"`|The name of the language.| -|`displayName`|`"EN"`|The name used when the language appears on the website.| -|`isoCode`|`"en"`|The ISO language code for HTML metadata purposes. It can be a top-level language (ie. `en`) or a sub-variant (ie. `en-AU`).| |`weight`|`1`|The weight determines the order of languages when building multilingual sites.| -|`rtl`|`false`|Whether or not this is a RTL language. Set to `true` to reflow content from right-to-left. Congo fully supports using RTL and LTR languages at the same time and will dynamically adjust to both.| |`title`|`"Congo"`|The title of the website. This will be displayed in the site header and footer.| -|`description`|_Not set_|The website description. This will be used in the site metadata.| |`copyright`|_Not set_|A Markdown string containing the copyright message to be displayed in the site footer. If none is provided, Congo will automatically generate a copyright string using the site `title`.| -|`dateFormat`|`"2 January 2006"`|How dates are formatted in this language. Refer to the [Hugo docs](https://gohugo.io/functions/format/#gos-layout-string) for acceptable formats.| +|`params.isoCode`|`"en"`|The ISO language code for HTML metadata purposes. It can be a top-level language (ie. `en`) or a sub-variant (ie. `en-AU`).| +|`params.displayName`|`"EN"`|The name used when the language appears on the website.| +|`params.rtl`|`false`|Whether or not this is a RTL language. Set to `true` to reflow content from right-to-left. Congo fully supports using RTL and LTR languages at the same time and will dynamically adjust to both.| +|`params.dateFormat`|`"2 January 2006"`|How dates are formatted in this language. Refer to the [Hugo docs](https://gohugo.io/functions/format/#gos-layout-string) for acceptable formats.| |`params.mainSections`|_Not set_|The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used.| +|`params.description`|_Not set_|The website description. This will be used in the site metadata.| |`author.name`|_Not set_|The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used.| |`author.image`|_Not set_|Path to the image file of the author. The image should be a 1:1 aspect ratio and placed in the site's `assets/` folder.| |`author.headline`|_Not set_|A Markdown string containing the author's headline. It will be displayed on the profile homepage under the author's name.| diff --git a/layouts/_default/index.json b/layouts/_default/index.json index 20e328a4..dc450894 100644 --- a/layouts/_default/index.json +++ b/layouts/_default/index.json @@ -3,7 +3,7 @@ {{- $section := .Site.GetPage "section" .Section -}} {{- $showDate := .Params.showDate | default .Site.Params.article.showDate -}} {{- $index = $index | append (dict - "date" (cond (and .IsPage $showDate) (.Date | time.Format (.Site.Language.Params.dateFormat | default ":date_long")) nil) + "date" (cond (and .IsPage $showDate) (.Date | time.Format (site.Params.dateFormat | default ":date_long")) nil) "title" (.Title | emojify | safeJS) "section" ($section.Title | emojify | safeJS) "summary" (.Summary | emojify | safeJS) diff --git a/layouts/partials/functions/date.html b/layouts/partials/functions/date.html index d9ae5439..6234cb7c 100644 --- a/layouts/partials/functions/date.html +++ b/layouts/partials/functions/date.html @@ -1 +1 @@ -{{ return time.Format (site.Language.Params.dateFormat | default ":date_long") . }} +{{ return time.Format (site.Params.dateFormat | default ":date_long") . }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index e2f6adc8..0cc97825 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,6 +1,6 @@
- {{ with .Site.Language.Params.htmlCode | default .Site.LanguageCode }} + {{ with site.Params.htmlCode | default .Site.LanguageCode }} {{ end }} diff --git a/layouts/partials/translations.html b/layouts/partials/translations.html index 979e151f..a9514057 100644 --- a/layouts/partials/translations.html +++ b/layouts/partials/translations.html @@ -1,11 +1,11 @@ {{ if .IsTranslated }} -