Hugo: Expose DefaultContentLanguage in Site variables

Created on 6 Jul 2020  路  3Comments  路  Source: gohugoio/hugo

Currently, there's no way to get the default language of the site (other than assuming it has the smallest weight in the list of AllTranslations, with some caveats). This variable would be useful for creating conditions, for example (in my case) to check if a localized documentation is up-to-date with the original page.

Proposal

Most helpful comment

Though not very intuitive, .Sites.First.Language will give you what you're looking for (.Sites.First.Language.Lang returns the language code)

All 3 comments

Though not very intuitive, .Sites.First.Language will give you what you're looking for (.Sites.First.Language.Lang returns the language code)

Is there any documentation for .Sites.First or .Sites? I can't seem to find it in Hugo Docs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

antifuchs picture antifuchs  路  3Comments

MunifTanjim picture MunifTanjim  路  3Comments

VoidingWarranties picture VoidingWarranties  路  3Comments

carandraug picture carandraug  路  3Comments

ianbrandt picture ianbrandt  路  3Comments