diff options
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/config_test.go | 6 | ||||
-rw-r--r-- | hugolib/site_new.go | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go index 2f9c6e3f6..f742eb862 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -824,6 +824,7 @@ baseURL = "https://example.com" disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT"] [languages] [languages.en] +languageCode = "en-US" title = "English Title" [languages.en.params] myparam = "enParamValue" @@ -840,6 +841,7 @@ title: "My English Section" title: "My Swedish Section" --- -- layouts/index.html -- +LanguageCode: {{ eq site.LanguageCode site.Language.LanguageCode }}|{{ site.Language.LanguageCode }}| {{ range $i, $e := (slice site .Site) }} {{ $i }}|AllPages: {{ len .AllPages }}|Sections: {{ if .Sections }}true{{ end }}| Author: {{ .Authors }}|BuildDrafts: {{ .BuildDrafts }}|IsMultiLingual: {{ .IsMultiLingual }}|Param: {{ .Language.Params.myparam }}|Language string: {{ .Language }}|Languages: {{ .Languages }} {{ end }} @@ -863,10 +865,12 @@ Sections: true| Param: enParamValue Param: enParamValue IsMultiLingual: true +LanguageCode: true|en-US| `) b.AssertFileContent("public/sv/index.html", ` -Param: svParamValue +Param: svParamValue +LanguageCode: true|sv| `) diff --git a/hugolib/site_new.go b/hugolib/site_new.go index e5398ba8d..4b3a28bdd 100644 --- a/hugolib/site_new.go +++ b/hugolib/site_new.go @@ -361,10 +361,7 @@ func (s *Site) Config() page.SiteConfig { } func (s *Site) LanguageCode() string { - if s.conf.LanguageCode != "" { - return s.conf.LanguageCode - } - return s.language.Lang + return s.Language().LanguageCode() } // Returns all Sites for all languages. |