From 92e86702eab5d68cd4eda87069fba906139f5c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 7 Jul 2023 18:41:10 +0200 Subject: Fix defaultContentLanguageInSubdir with only 1 language Fixes #10064 --- hugolib/site.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'hugolib/site.go') diff --git a/hugolib/site.go b/hugolib/site.go index 7a3528929..eb6a4e344 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -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 - - if !isDefault || s.conf.DefaultContentLanguageInSubdir { - return s.Language().Lang - } + return s.GetLanguagePrefix() - return "" } func (s *Site) getTaxonomyKey(key string) string { -- cgit v1.2.3