New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistency between .Translations and .Resources in a multilingual multi-host website #12333
Comments
I've just tried it with:
and the problem is still there. It is somewhat different to #12320, though. |
This isn't a regression... v0.122.0 and v0.124.1 behave identically. config
content
published (v0.122.0)
published (v0.124.1) (same as above)
expected
test site
test casetest casefunc TestFoo(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
disableKinds = ['home','section','rss','sitemap','taxonomy','term']
defaultContentLanguage = 'en'
defaultContentLanguageInSubdir = true
[languages.en]
baseURL = "https://en.example.org"
contentDir = "content/en"
[languages.fr]
baseURL = "https://fr.example.org"
contentDir = "content/fr"
-- layouts/_default/single.html --
{{ .Title }}
-- content/en/p1/index.md --
---
title: p1
translationKey: en-p1
---
-- content/fr/p1/index.md --
---
title: p1
translationKey: fr-p1
---
-- content/en/p1/a.txt --
a
-- content/fr/p1/b.txt --
b
`
b := hugolib.Test(t, files)
b.AssertFileExists("public/en/p1/a.txt", true)
b.AssertFileExists("public/en/p1/b.txt", false) // failing test
b.AssertFileExists("public/fr/p1/b.txt", true)
b.AssertFileExists("public/fr/p1/a.txt", false) // failing test
} |
After double-checking that, I agree that this might not be a regression. I used to have a few resources belonging to the home directory in v0.122 which were not shared or bundled even without You fixed that in v0.123 and the resources started getting bundled and copied which was not what I needed, so I tried to "unlink" them by providing different Let me know if you want a repo with that setup for v0.122. It is a little unrelated to this specific issue, so I didn't provide that initially. |
See #12320 for the beginning of the discussion.
For a multilingual multi-host site the page resources are kept shared even if the pages are not considered the translations of each other. This started in 0.123 and is still a problem in the latest version.
See the repository here: https://github.com/ov/hugo-bundle-issue
It has two translations placed into different folders. Each translation has two folders
bundled
andnot-bundled
. The difference is that the pages innot-bundled
havetranslationKey
defined to be different for both languages, so they don't think they are the translations. Thebundled
pages don't have that key explicitly set, so are considered the translations of each other.The code in
layout/_default
is the same forlist
andsingle
and shows the translations and the resources of the page.Now if you build a site and check the
/bundled/
pages for both translations, you'll notice that both pages see each other as translations and have their resources shared. That's the expected behaviour of a page bundle, that's fine.Now check the
/not-bundled/
pages of both translations. You'll find that they don't see each other as translations (due to the differenttranslationKey
), but still share the resources. You can also see that all the resources are present inpublic/<lang>/not-bundled/
folders.Expected behaviour: if the pages don't see each other as translations, their resources should not be shared, copied and mentioned in
.Resources
Actual behaviour: the resources are shared, copied and mentioned, which looks inconsistent.
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
yes
The text was updated successfully, but these errors were encountered: