theNewDynamic / gohugo-theme-ananke

Ananke: A theme for Hugo Sites
https://gohugo-ananke-theme-demo.netlify.com/
MIT License
1.09k stars 1.12k forks source link

Update Theme Template to Properly Indicate Current Language #648

Open mulder999 opened 11 months ago

mulder999 commented 11 months ago

I would like to suggest an update to the current theme template in order to correctly indicate the current language using the .Lang variable instead of the static values .site.LanguageCode and site.Language.Lang.

Currently, the template uses the following code:

<html lang="{{ site.LanguageCode | default site.Language.Lang }}" ...

However, to accurately represent the current language, we should use the .Lang variable.

I propose updating the template as follows:

<html lang="{{ with .Lang }}{{ . }}{{ else }}{{ site.LanguageCode | default site.Language.Lang }}{{ end }}" ...

With this change, the template will check if .Lang is defined and use it as the language value. If it is not defined, it will fallback to site.LanguageCode if available, or site.Language.Lang if neither .Lang nor site.LanguageCode are available.

This modification ensures that the template accurately reflects the current language being used.

Thank you for considering this improvement.