🚨 Support new language params changes in Hugo

pull/567/head
James Panther 2023-05-25 14:12:42 +10:00
parent aba3d34482
commit 50c5d212de
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
8 changed files with 27 additions and 23 deletions

View File

@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Added ### 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 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)) - 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)) - 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 ### 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)) - 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 - Adopted new Tailwind logical properties for RTL styling
- Updated Dutch translation ([#544](https://github.com/jpanther/congo/pull/544)) - Updated Dutch translation ([#544](https://github.com/jpanther/congo/pull/544))

View File

@ -1,18 +1,19 @@
languageCode = "en" languageCode = "en"
languageName = "English" languageName = "English"
displayName = "EN"
isoCode = "en"
weight = 1 weight = 1
rtl = false
title = "Congo" title = "Congo"
# description = "My awesome website"
# copyright = "Copy, _right?_ :thinking_face:" # copyright = "Copy, _right?_ :thinking_face:"
[params]
isoCode = "en"
displayName = "EN"
rtl = false
dateFormat = "2 January 2006" dateFormat = "2 January 2006"
[params]
# mainSections = ["section1", "section2"] # mainSections = ["section1", "section2"]
# description = "My awesome website"
[author] [author]
# name = "Your name here" # name = "Your name here"

View File

@ -1,18 +1,19 @@
languageCode = "en-au" languageCode = "en-au"
languageName = "English (Australia)" languageName = "English (Australia)"
displayName = ":flag-au:"
isoCode = "en-AU"
weight = 1 weight = 1
rtl = false
title = "Congo" title = "Congo"
description = "A powerful, lightweight theme for Hugo built with Tailwind CSS."
copyright = "© 2023 Congo contributors" copyright = "© 2023 Congo contributors"
[params]
isoCode = "en-AU"
displayName = ":flag-au:"
rtl = false
dateFormat = "2 January 2006" dateFormat = "2 January 2006"
[params]
mainSections = ["samples"] mainSections = ["samples"]
description = "A powerful, lightweight theme for Hugo built with Tailwind CSS."
[author] [author]
name = "Congo" name = "Congo"

View File

@ -89,17 +89,17 @@ The default file can be used as a template to create additional languages, or re
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
|Name|Default|Description| |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.| |`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.| |`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.| |`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`.| |`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.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.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.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.| |`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.|

View File

@ -3,7 +3,7 @@
{{- $section := .Site.GetPage "section" .Section -}} {{- $section := .Site.GetPage "section" .Section -}}
{{- $showDate := .Params.showDate | default .Site.Params.article.showDate -}} {{- $showDate := .Params.showDate | default .Site.Params.article.showDate -}}
{{- $index = $index | append (dict {{- $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) "title" (.Title | emojify | safeJS)
"section" ($section.Title | emojify | safeJS) "section" ($section.Title | emojify | safeJS)
"summary" (.Summary | emojify | safeJS) "summary" (.Summary | emojify | safeJS)

View File

@ -1 +1 @@
{{ return time.Format (site.Language.Params.dateFormat | default ":date_long") . }} {{ return time.Format (site.Params.dateFormat | default ":date_long") . }}

View File

@ -1,6 +1,6 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
{{ with .Site.Language.Params.htmlCode | default .Site.LanguageCode }} {{ with site.Params.htmlCode | default .Site.LanguageCode }}
<meta http-equiv="content-language" content="{{ . }}" /> <meta http-equiv="content-language" content="{{ . }}" />
{{ end }} {{ end }}
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />

View File

@ -1,11 +1,11 @@
{{ if .IsTranslated }} {{ if .IsTranslated }}
<ul class="flex flex-row list-none"> <ul class="flex list-none flex-row">
{{ range .AllTranslations }} {{ range .AllTranslations }}
<li class="ml-2"> <li class="ml-2">
<a <a
href="{{ .RelPermalink }}" href="{{ .RelPermalink }}"
class="decoration-primary-500 hover:underline hover:decoration-2 hover:underline-offset-2" class="decoration-primary-500 hover:underline hover:decoration-2 hover:underline-offset-2"
>{{ .Language.Params.displayName | emojify }}</a >{{ site.Params.displayName | emojify }}</a
> >
</li> </li>
{{ end }} {{ end }}