Skip to content

Inconsistency between .Translations and .Resources in a multilingual multi-host website #12333

Open
@ov

Description

@ov

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 and not-bundled. The difference is that the pages in not-bundled have translationKey defined to be different for both languages, so they don't think they are the translations. The bundled pages don't have that key explicitly set, so are considered the translations of each other.

The code in layout/_default is the same for list and single 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 different translationKey), but still share the resources. You can also see that all the resources are present in public/<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)?

$ hugo version
hugo v0.124.1+extended darwin/arm64 BuildDate=unknown

Does this issue reproduce with the latest release?

yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions