Multiple files for configuration setting like Menu, language etc. as per here.
Folder structure is:
config/
_default/
config.toml
languages.toml
menu.toml
params.toml
production
staging
Expected result
Configurations from all files within a folder ( like _default ) should merge together.
Result
Configuration from languages.toml is not loading. It seems Hugo is not even reading this file. Hugo is only reading config.toml in the _default directory
Stack
Hugo version: hugo v0.93.3+extended linux/amd64 BuildDate=unknown
OS: Fedora 36
{{/* Multilang support for lang attribute */}}
<html lang="{{ or (.Site.LanguageCode) (.Site.Language.Lang) }}" prefix="og: https://ogp.me/ns#{{ if in .Site.Params.mainTypes .Type }} article: https://ogp.me/ns/article#{{ end }}" class="h-feed">
In language selection, I have something like:
<menu id="lang-menu" class="flyout-menu menu">
<a href="#" lang="{{ or (.Site.LanguageCode) (.Site.Language.Lang) }}" class="nav link active" title="{{ .Site.Language.LanguageName }}">{{ .Site.Language.Params.languageflag }} ({{ .Site.Language.LanguageName }})</a>
{{ if .IsTranslated -}}
{{ range .Translations }}
<a href="{{ .Permalink }}" lang="{{ or (.Site.LanguageCode) (.Site.Language.Lang) }}" class="nav link" title="{{ .Site.Language.LanguageName }}">{{ .Site.Language.Params.languageflag }} ({{ .Language.LanguageName }})</a>
{{ end }}
{{ else }}
{{ range .Site.Languages }}
{{ if not (eq .Lang $.Site.Language.Lang) }}
<span class="nav no-lang link" title="{{ .Params.LanguageName }}">{{ .Params.languageflag }} ({{ .Params.LanguageName }})</span>
{{ end }}
{{ end }}
{{ end }}
</menu>
I use the other custom fields like so:
{{ if not .PublishDate.IsZero }}<time datetime="{{ .PublishDate.UTC.Format "2006-01-02T15:04:05Z07:00" }}" class="dt-published">{{ time.Format $datetimeformat (.PublishDate.UTC.Add (time.ParseDuration $.Site.Language.Params.tzOffset)) }} <abbr{{ with $.Site.Language.Params.tzAbbrTitle }} title="{{ printf "%s" . }}"{{ end }}>{{ $.Site.Language.Params.tzAbbr }}</abbr></time>{{ end }}
You can see it live here: Snoworld โ๏ธ (I customized the timezone abbreviation; and added auto-calculation of time.)
Thanks. I was making the mistake in referencing the language key as `[languages.en]โ . Fixed it by referencing Hugo docs repo.
Thank you for the detailed response on language menu.