-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
multilingual multihost: Branch bundle resource inadvertently published to other language when content and resource have the same file name #12320
Comments
TLDRThis behavior is expected and desired with v0.123.0 and later, related to these announced breaking changes:
ExplanationLet's change the example to use JPEG files instead of PHP files. This makes no functional difference, but removes any conceptual confusion regarding content vs. template vs. resource.
This site has one page... the home page. Due to the changes noted above, each of these files is a page resource for the
Page resources are shared across languages. In a multihost configuration this produces:
Again, this is the expected behavior now that a branch bundle's resources may reside in subfolders. |
@jmooring thanks for the prompt reply and sorry that I missed that this is now by design. Is there a chance you could consider making this sharing optional? I see where it helps, but in my case I end up with hundreds of images copied to another website, although that page does not exist on that website at all. Maybe we could have a flag in the front matter? Or maybe using a different |
In the example above, there is only one page (the home page), and it obviously exists on both sites. All of the JPEG files are page resources, belonging to the home page branch bundle. We have no way of knowing that you don't want to share It sounds to me like you need to change were some of these resources live. I suspect you have images in branch bundles that should instead live in page bundles. |
I have a few problems after the migration and the example above is a simple one. I could probably survive by moving those files to the language-specific subfolders of The other example I mentioned is slightly different. Here's what it looks like:
The I might have abused the leaf/branch structure here a bit, but it works within Anyways, the other translation of the website does not have that Here's what I get instead:
The question is why do I get a copy of the thumbnails in
I believe that there are some cases when we actually have a way. Besides the specific "no share" flag, here's what comes to mind from the above. I don't want to share b.jpg between two languages if both translations have
I tried the latter one by creating a dummy What do you think? |
Does the ru folder contain a gallery page or section? I ask becaiuse this content structure:
Is published to:
If you have a gallery section on the ru site, the images will be copied to the ru site because they are resources of the gallery branch bundle. Perhaps you should make the set directories into branch bundles, or place the images within the leaf bundles. |
The The home page has its own
No, I mentioned that above. There is no |
Please try this site and tell me what's different:
EDIT: I just force pushed a change. 2024-03-31T14:20:05-07:00. |
OK, my bad, I didn't provide all the information. Your repo works well and there's no The thing is that in the real website here, the Try renaming |
A minimal example looks like this: Configuration:
Content:
Expected (v0.122.0):
Actual (v0.123.0 and later):
This may be related to #12198. Test case func TestFoo(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
disableKinds = ['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"
-- content/en/s1/p1.md --
---
title: p1
---
-- content/en/s1/p1.txt --
---
p1.txt
---
-- layouts/_default/single.html --
{{ .Title }}|
-- layouts/_default/list.html --
{{ .Title }}|
`
b := hugolib.Test(t, files)
b.AssertFileExists("public/en/s1/index.html", true)
b.AssertFileExists("public/en/s1/p1/index.html", true)
b.AssertFileExists("public/en/s1/p1.txt", true)
b.AssertFileExists("public/fr/s1/index.html", false)
b.AssertFileExists("public/fr/s1/p1/index.html", false)
b.AssertFileExists("public/fr/s1/p1.txt", false) // failing test
} |
I can confirm the problem is fixed, thank you. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have a multilingual multihost site, so different languages are rendered to different domains (and so folders in
public
). The content for different languages is completely independent, just some layouts, partials and shortcodes are shared.Starting from v0.123 I see that some content is "leaking" from one language to another. Say I have this:
The config is:
The generated sites structure looks like this:
Note that
xxx.php
has leaked to the other language site. This didn't happen inv0.122.0
, it started inv0.123.0
and can be reproduced inlatest
.The sites have multiple pages, but this only happens to "resources", not html or markdown files. I see it happens to php files in
v0.123.0
, but if switching tolatest
it starts affecting images in folders without html or markdown files. Looks like it's getting worse.I see some similar issues around, but they are mostly related to "shared" translations where the resources are mixed with multilingual html content. In my case the content is completely separate, assuming no "leaking" should ever happen.
Any ideas?
Thank you!
What version of Hugo are you using (
hugo version
)?This started with v0.123.0 and still happens in
latest
. Works fine in v0.122.0Does this issue reproduce with the latest release?
Yes
The text was updated successfully, but these errors were encountered: