Fix defaultContentLanguageInSubdir with only 1 language

Fixes #10064
This commit is contained in:
Bjørn Erik Pedersen
2023-07-07 18:41:10 +02:00
parent 6c9ea022a9
commit 92e86702ea
12 changed files with 154 additions and 101 deletions

View File

@@ -887,21 +887,16 @@ func (s *Site) getLanguageTargetPathLang(alwaysInSubDir bool) string {
// get any language code to prefix the relative permalink with.
func (s *Site) getLanguagePermalinkLang(alwaysInSubDir bool) string {
if !s.h.isMultiLingual() || s.h.Conf.IsMultihost() {
if s.h.Conf.IsMultihost() {
return ""
}
if alwaysInSubDir {
if s.h.Conf.IsMultiLingual() && alwaysInSubDir {
return s.Language().Lang
}
isDefault := s.Language().Lang == s.conf.DefaultContentLanguage
return s.GetLanguagePrefix()
if !isDefault || s.conf.DefaultContentLanguageInSubdir {
return s.Language().Lang
}
return ""
}
func (s *Site) getTaxonomyKey(key string) string {