-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify languageCode
default in multilingual page
#2564
Conversation
I'm not sure what you're referring to, but the opengraph template does this:
So the template defaults to the language key, but .Language.LanguageCode has a default of "". |
I have a setup where |
You're right. It looks like we changed the behavior in v0.112.0 and didn't update the docs. |
We can also see this at work in https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/alias.html, which uses |
This is surprising (sort of)...
The en site returns "en" instead of "foo". Something doesn't seem right here. The above is true for monolingual sites as well. As soon as you define a language, the |
@chalin Technically the So I think it would be better to update those method descriptions: Also, if you wouldn't mind, please update the description of We should find a way to indicate that this value is ignored if a language key is present (or something to that effect). And then we should go back through the embedded templates and remove the fallback logic since Hugo handles that with v0.112.0 and later. See gohugoio/hugo#12480 and gohugoio/hugo#12479. I will fix various example in #2565. |
Sorry to hijack the discussion but I just want to confirm the TOML table name for individual languages: is it
|
@IUSR Keys are converted to lowercase internally, but you should get in the habit of using the case as shown in the documentation. Please use the forum (https://discourse.gohugo.io/) for questions and troubleshooting. |
Closes gohugoio#2564 Co-authored-by: chalin <chalin@users.noreply.github.com>
According to my tests,
languageCode
defaults to the active language's language key.