mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
common/hugo: Rename IsMultiHost and IsMultiLingual
hugo.IsMultiHost => hugo.IsMultihost hugo.IsMultiLingual => hugo.IsMultilingual Closes #12232
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
4f92f949ea
commit
dc6a292133
@@ -508,12 +508,12 @@ func TestLoadConfigFromThemeDir(t *testing.T) {
|
||||
theme = "test-theme"
|
||||
|
||||
[params]
|
||||
m1 = "mv1"
|
||||
m1 = "mv1"
|
||||
`
|
||||
|
||||
themeConfig := `
|
||||
[params]
|
||||
t1 = "tv1"
|
||||
t1 = "tv1"
|
||||
t2 = "tv2"
|
||||
`
|
||||
|
||||
@@ -885,9 +885,9 @@ ThisIsAParam: {{ site.Params.thisIsAParam }}
|
||||
).BuildE()
|
||||
|
||||
b.Assert(err, qt.IsNil)
|
||||
b.AssertFileContent("public/index.html", `
|
||||
b.AssertFileContent("public/index.html", `
|
||||
MyParam: enParamValue
|
||||
ThisIsAParam: thisIsAParamValue
|
||||
ThisIsAParam: thisIsAParamValue
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -919,7 +919,7 @@ title: "My Swedish Section"
|
||||
-- layouts/index.html --
|
||||
LanguageCode: {{ eq site.LanguageCode site.Language.LanguageCode }}|{{ site.Language.LanguageCode }}|
|
||||
{{ range $i, $e := (slice site .Site) }}
|
||||
{{ $i }}|AllPages: {{ len .AllPages }}|Sections: {{ if .Sections }}true{{ end }}| Author: {{ .Authors }}|BuildDrafts: {{ .BuildDrafts }}|IsMultiLingual: {{ .IsMultiLingual }}|Param: {{ .Language.Params.myparam }}|Language string: {{ .Language }}|Languages: {{ .Languages }}
|
||||
{{ $i }}|AllPages: {{ len .AllPages }}|Sections: {{ if .Sections }}true{{ end }}| Author: {{ .Authors }}|BuildDrafts: {{ .BuildDrafts }}|IsMultilingual: {{ .IsMultiLingual }}|Param: {{ .Language.Params.myparam }}|Language string: {{ .Language }}|Languages: {{ .Languages }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
@@ -939,9 +939,9 @@ LanguageCode: {{ eq site.LanguageCode site.Language.LanguageCode }}|{{ site.Lang
|
||||
b.AssertFileContent("public/index.html", `
|
||||
AllPages: 4|
|
||||
Sections: true|
|
||||
Param: enParamValue
|
||||
Param: enParamValue
|
||||
IsMultiLingual: true
|
||||
Param: enParamValue
|
||||
Param: enParamValue
|
||||
IsMultilingual: true
|
||||
LanguageCode: true|en-US|
|
||||
`)
|
||||
|
||||
@@ -1062,7 +1062,7 @@ Home
|
||||
).BuildE()
|
||||
|
||||
b.Assert(err, qt.IsNil)
|
||||
b.AssertFileContent("public/index.html", `
|
||||
b.AssertFileContent("public/index.html", `
|
||||
Home
|
||||
`)
|
||||
|
||||
@@ -1095,7 +1095,7 @@ HTML.
|
||||
HTACCESS.
|
||||
|
||||
|
||||
|
||||
|
||||
`
|
||||
b := Test(t, files)
|
||||
|
||||
@@ -1111,7 +1111,7 @@ languageCode = "en-US"
|
||||
-- layouts/index.html --
|
||||
LanguageCode: {{ .Site.LanguageCode }}|{{ site.Language.LanguageCode }}|
|
||||
|
||||
|
||||
|
||||
`
|
||||
b := Test(t, files)
|
||||
|
||||
@@ -1137,7 +1137,7 @@ suffixes = ["bar"]
|
||||
-- layouts/index.html --
|
||||
Home.
|
||||
|
||||
|
||||
|
||||
`
|
||||
b := Test(t, files)
|
||||
|
||||
@@ -1164,8 +1164,8 @@ func TestConfigMiscPanics(t *testing.T) {
|
||||
params:
|
||||
-- layouts/index.html --
|
||||
Foo: {{ site.Params.foo }}|
|
||||
|
||||
|
||||
|
||||
|
||||
`
|
||||
b := Test(t, files)
|
||||
|
||||
@@ -1188,8 +1188,8 @@ defaultContentLanguage = "en"
|
||||
weight = 1
|
||||
-- layouts/index.html --
|
||||
Foo: {{ site.Params.foo }}|
|
||||
|
||||
|
||||
|
||||
|
||||
`
|
||||
b, err := NewIntegrationTestBuilder(
|
||||
IntegrationTestConfig{
|
||||
@@ -1215,8 +1215,8 @@ languageCode = "en"
|
||||
languageName = "English"
|
||||
weight = 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
`
|
||||
b, err := NewIntegrationTestBuilder(
|
||||
IntegrationTestConfig{
|
||||
@@ -1241,7 +1241,7 @@ contentDir = "mycontent"
|
||||
-- layouts/index.html --
|
||||
Home.
|
||||
|
||||
|
||||
|
||||
`
|
||||
b := Test(t, files)
|
||||
|
||||
@@ -1343,7 +1343,7 @@ disabled = true
|
||||
-- layouts/index.html --
|
||||
Home.
|
||||
|
||||
|
||||
|
||||
`
|
||||
b := Test(t, files)
|
||||
|
||||
@@ -1438,7 +1438,7 @@ home = ["html"]
|
||||
-- hugo.toml --
|
||||
baseURL = "https://example.com"
|
||||
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
|
||||
|
||||
|
||||
`
|
||||
|
||||
runVariant(t, files, nil)
|
||||
|
@@ -1778,7 +1778,7 @@ func (sa *sitePagesAssembler) addStandalonePages() error {
|
||||
|
||||
if sitemapEnabled {
|
||||
addStandalone("/_sitemap", kinds.KindSitemap, output.SitemapFormat)
|
||||
skipSitemapIndex := s.Conf.IsMultihost() || !(s.Conf.DefaultContentLanguageInSubdir() || s.Conf.IsMultiLingual())
|
||||
skipSitemapIndex := s.Conf.IsMultihost() || !(s.Conf.DefaultContentLanguageInSubdir() || s.Conf.IsMultilingual())
|
||||
|
||||
if !skipSitemapIndex {
|
||||
addStandalone("/_sitemapindex", kinds.KindSitemapIndex, output.SitemapIndexFormat)
|
||||
|
@@ -315,7 +315,7 @@ func TestStaticFs(t *testing.T) {
|
||||
checkFileContent(sfs, "f2.txt", c, "Hugo Themes Still Rocks!")
|
||||
}
|
||||
|
||||
func TestStaticFsMultiHost(t *testing.T) {
|
||||
func TestStaticFsMultihost(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
v := config.New()
|
||||
workDir := "mywork"
|
||||
@@ -537,7 +537,7 @@ SCSS Match: {{ with resources.Match "**.scss" }}{{ . | len }}|{{ range .}}{{ .Re
|
||||
|
||||
b := hugolib.Test(t, files)
|
||||
|
||||
b.AssertFileContent("public/index.html", `
|
||||
b.AssertFileContent("public/index.html", `
|
||||
SCSS: /scss/app.scss|body { color: blue; }|
|
||||
SCSS Match: 2|
|
||||
`)
|
||||
|
@@ -269,7 +269,7 @@ func (h *HugoSites) pickOneAndLogTheRest(errors []error) error {
|
||||
return errors[i]
|
||||
}
|
||||
|
||||
func (h *HugoSites) isMultiLingual() bool {
|
||||
func (h *HugoSites) isMultilingual() bool {
|
||||
return len(h.Sites) > 1
|
||||
}
|
||||
|
||||
|
@@ -66,12 +66,12 @@ robots|{{ site.Language.Lang }}
|
||||
404|{{ site.Language.Lang }}
|
||||
|
||||
|
||||
|
||||
|
||||
`
|
||||
|
||||
b := Test(t, files)
|
||||
|
||||
b.Assert(b.H.Conf.IsMultiLingual(), qt.Equals, true)
|
||||
b.Assert(b.H.Conf.IsMultilingual(), qt.Equals, true)
|
||||
b.Assert(b.H.Conf.IsMultihost(), qt.Equals, true)
|
||||
|
||||
// helpers.PrintFs(b.H.Fs.PublishDir, "", os.Stdout)
|
||||
|
@@ -297,7 +297,6 @@ func (s *siteRefLinker) refLink(ref string, source any, relative bool, outputFor
|
||||
ref = filepath.ToSlash(ref)
|
||||
|
||||
refURL, err = url.Parse(ref)
|
||||
|
||||
if err != nil {
|
||||
return s.notFoundURL, err
|
||||
}
|
||||
@@ -681,7 +680,7 @@ func (s *Site) getLanguagePermalinkLang(alwaysInSubDir bool) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
if s.h.Conf.IsMultiLingual() && alwaysInSubDir {
|
||||
if s.h.Conf.IsMultilingual() && alwaysInSubDir {
|
||||
return s.Language().Lang
|
||||
}
|
||||
|
||||
|
@@ -484,10 +484,10 @@ func (s *Site) BuildDrafts() bool {
|
||||
return s.conf.BuildDrafts
|
||||
}
|
||||
|
||||
// Deprecated: Use hugo.IsMultiLingual instead.
|
||||
// Deprecated: Use hugo.IsMultilingual instead.
|
||||
func (s *Site) IsMultiLingual() bool {
|
||||
hugo.Deprecate(".Site.IsMultiLingual", "Use hugo.IsMultiLingual instead.", "v0.124.0")
|
||||
return s.h.isMultiLingual()
|
||||
hugo.Deprecate(".Site.IsMultiLingual", "Use hugo.IsMultilingual instead.", "v0.124.0")
|
||||
return s.h.isMultilingual()
|
||||
}
|
||||
|
||||
func (s *Site) LanguagePrefix() string {
|
||||
|
@@ -334,7 +334,7 @@ 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.h.Conf.IsMultihost() || !(s.h.Conf.DefaultContentLanguageInSubdir() || s.h.Conf.IsMultiLingual()) {
|
||||
if s.h.Conf.IsMultihost() || !(s.h.Conf.DefaultContentLanguageInSubdir() || s.h.Conf.IsMultilingual()) {
|
||||
// No need for a redirect
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user