Open ov opened 6 months ago
Before I look at this, if you haven't already done so, please build from HEAD and retest... https://github.com/gohugoio/hugo/issues/12320 was fixed this morning by https://github.com/gohugoio/hugo/pull/12331.
I've just tried it with:
hugo v0.125.0-DEV+extended darwin/arm64 BuildDate=unknown
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.
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/
│ └── p1/
│ ├── a.txt
│ └── index.md <-- translationKey: en-p1
└── fr/
└── p1/
├── b.txt
└── index.md <-- translationKey: fr-p1
public/
├── en/
│ └── p1/
│ ├── a.txt
│ ├── b.txt
│ └── index.html
└── fr/
└── p1/
├── a.txt
├── b.txt
└── index.html
public/
├── en/
│ └── p1/
│ ├── a.txt
│ ├── b.txt
│ └── index.html
└── fr/
└── p1/
├── a.txt
├── b.txt
└── index.html
public/
├── en/
│ └── p1/
│ ├── a.txt
│ └── index.html
└── fr/
└── p1/
├── b.txt
└── index.html
git clone --single-branch -b hugo-github-issue-12333 https://github.com/jmooring/hugo-testing hugo-github-issue-12333
cd hugo-github-issue-12333
rm -rf public && hugo && tree public
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 translationKey
provided. That just worked (I mentioned that in #12320). However, after checking the bundling rules it seems that the behaviour was incorrect in v0.122.
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 translationKey
elements. This didn't help, so I filed the report. I still think this is an inconsistency bug, but instead of regression this looks like a partially working fix or so.
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