b.AssertFileContent("public/en/index.html", "Home.")
b.AssertFileContent("public/en/foo/bar.txt", "Foo.")
+ b.AssertFileContent("public/index.html", "refresh")
+ b.AssertFileContent("public/sitemap.xml", "sitemapindex")
+ b.AssertFileContent("public/en/sitemap.xml", "urlset")
})
t.Run("Two languages, default in sub dir", func(t *testing.T) {
b.AssertFileContent("public/en/index.html", "Home.")
b.AssertFileContent("public/en/foo/bar.txt", "Foo.")
+ b.AssertFileContent("public/index.html", "refresh")
+ b.AssertFileContent("public/sitemap.xml", "sitemapindex")
+ b.AssertFileContent("public/en/sitemap.xml", "urlset")
})
t.Run("Two languages, default in root", func(t *testing.T) {
b.AssertFileContent("public/index.html", "Home.")
b.AssertFileContent("public/foo/bar.txt", "Foo.")
+ b.AssertFileContent("public/sitemap.xml", "sitemapindex")
+ b.AssertFileContent("public/en/sitemap.xml", "urlset")
})
}
// 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.h.isMultiLingual() || s.h.Conf.IsMultihost() {
+ if s.h.Conf.IsMultihost() || !(s.h.Conf.DefaultContentLanguageInSubdir() || s.h.Conf.IsMultiLingual()) {
// No need for a redirect
return nil
}