mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
config: Setups with only one active language can never be multihost
Fixes #12288
This commit is contained in:
parent
7203a95a60
commit
babcb339a8
2 changed files with 31 additions and 0 deletions
|
@ -71,6 +71,9 @@ func (c ConfigLanguage) Environment() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c ConfigLanguage) IsMultihost() bool {
|
func (c ConfigLanguage) IsMultihost() bool {
|
||||||
|
if len(c.m.Languages)-len(c.config.C.DisabledLanguages) <= 1 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return c.m.IsMultihost
|
return c.m.IsMultihost
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -252,3 +252,31 @@ Files: {{ range $files }}{{ .Permalink }}|{{ end }}$
|
||||||
b.AssertFileContent("public/en/enpages/mybundle-en/file2.txt", "File 2 en.")
|
b.AssertFileContent("public/en/enpages/mybundle-en/file2.txt", "File 2 en.")
|
||||||
b.AssertFileContent("public/fr/section/mybundle/file2.txt", "File 2 en.")
|
b.AssertFileContent("public/fr/section/mybundle/file2.txt", "File 2 en.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMultihostAllButOneLanguageDisabledIssue12288(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
defaultContentLanguage = "en"
|
||||||
|
disableLanguages = ["fr"]
|
||||||
|
#baseURL = "https://example.com"
|
||||||
|
[languages]
|
||||||
|
[languages.en]
|
||||||
|
baseURL = "https://example.en"
|
||||||
|
weight = 1
|
||||||
|
[languages.fr]
|
||||||
|
baseURL = "https://example.fr"
|
||||||
|
weight = 2
|
||||||
|
-- assets/css/main.css --
|
||||||
|
body { color: red; }
|
||||||
|
-- layouts/index.html --
|
||||||
|
{{ $css := resources.Get "css/main.css" | minify }}
|
||||||
|
CSS: {{ $css.Permalink }}|{{ $css.RelPermalink }}|
|
||||||
|
`
|
||||||
|
|
||||||
|
b := Test(t, files)
|
||||||
|
|
||||||
|
b.AssertFileContent("public/css/main.min.css", "body{color:red}")
|
||||||
|
b.AssertFileContent("public/index.html", "CSS: https://example.en/css/main.min.css|/css/main.min.css|")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue