Add config option disableDefaultLanguageRedirect

Fixes #13133
This commit is contained in:
Bjørn Erik Pedersen
2024-12-12 15:42:17 +01:00
parent e293e7ca6d
commit 75ad9cdaab
3 changed files with 29 additions and 0 deletions

View File

@@ -334,6 +334,9 @@ func (s *Site) renderAliases() error {
// renderMainLanguageRedirect creates a redirect to the main language home,
// depending on if it lives in sub folder (e.g. /en) or not.
func (s *Site) renderMainLanguageRedirect() error {
if s.conf.DisableDefaultLanguageRedirect {
return nil
}
if s.h.Conf.IsMultihost() || !(s.h.Conf.DefaultContentLanguageInSubdir() || s.h.Conf.IsMultilingual()) {
// No need for a redirect
return nil