if defaultInSubDir {
// should have a redirect on top level.
assertFileContent(t, "public/index.html", true, `<meta http-equiv="refresh" content="0; url=http://example.com/blog/fr" />`)
+ } else {
+ // should have redirect back to root
+ assertFileContent(t, "public/fr/index.html", true, `<meta http-equiv="refresh" content="0; url=http://example.com/blog" />`)
}
assertFileContent(t, "public/fr/index.html", defaultInSubDir, "Home", "Bonjour")
assertFileContent(t, "public/en/index.html", defaultInSubDir, "Home", "Hello")
}
}
- if s.owner.multilingual.enabled() && s.Info.defaultContentLanguageInSubdir {
+ if s.owner.multilingual.enabled() {
mainLang := s.owner.multilingual.DefaultLang.Lang
- mainLangURL := helpers.AbsURL(mainLang, false)
- jww.DEBUG.Printf("Write redirect to main language %s: %s", mainLang, mainLangURL)
- if err := s.publishDestAlias(s.languageAliasTarget(), "/", mainLangURL); err != nil {
- return err
+ if s.Info.defaultContentLanguageInSubdir {
+ mainLangURL := helpers.AbsURL(mainLang, false)
+ jww.DEBUG.Printf("Write redirect to main language %s: %s", mainLang, mainLangURL)
+ if err := s.publishDestAlias(s.languageAliasTarget(), "/", mainLangURL); err != nil {
+ return err
+ }
+ } else {
+ mainLangURL := helpers.AbsURL("", false)
+ jww.DEBUG.Printf("Write redirect to main language %s: %s", mainLang, mainLangURL)
+ if err := s.publishDestAlias(s.languageAliasTarget(), mainLang, mainLangURL); err != nil {
+ return err
+ }
}
}