-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Labels
Milestone
Description
This isn't anything new. I am able to reproduce with v0.54.0 and later.
func TestIssue12560(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
[languages.en]
baseURL = 'https://en.example.org/'
weight = 1
[languages.de]
baseURL = 'https://de.example.org/'
weight = 2
-- layouts/home.html --
{{ with resources.Get "main.css" }}{{ .Permalink }}{{ end }}
-- assets/main.css --
body {color: red;}
`
b := hugolib.Test(t, files)
b.AssertFileContent("public/en/main.css", "body {color: red;}")
b.AssertFileContent("public/en/index.html", "https://en.example.org/main.css")
b.AssertFileContent("public/de/main.css", "body {color: red;}")
b.AssertFileContent("public/de/index.html", "https://de.example.org/main.css") // fails
}
The last assertion fails; the file is identical to public/en/index.html, which means it's pointing to the wrong site.
Reference: https://discourse.gohugo.io/t/multihost-trouble/50103
The work around is to use RelPermalink
instead:
{{ with resources.Get "main.css" }}
{{ .RelPermalink }}
{{ end }}