Translatable content in themes?

For a custom (as in in-house) theme I would like to provide a privacy statement from a theme. This statement should be provided in different languages (German and English).
It’s sure possible to provide it in the appropriate language TOML, but that’s a bit confusing especially since the composition of multiple language files has been removed a while back.

Is there better way then for example creating a shortcode for this purpose? For example referencing a markdown file from a i18n TOML file? Or by providing content from a theme? There was a discussion on this once

I was quite stupid in assuming it’s not possible to use content from a theme: Although it is not possible to include the directory via inheritance, its possible using mounts like this:

[module]
    [[module.mounts]]
        source = "themes/theme/content"
        target = "content"

Next to test if this also works with index.en.md or index.en.md with changing default languages of the site using the theme. That is that the language of a index.md file changes depending of the default languaage of the site using the theme…

I don’t understand. A theme/module content directory is part of the union file system.

hugo new site mysite
cd mysite
hugo new theme mytheme
echo "theme = 'mytheme'" >> hugo.toml
hugo server

Note that all of the content is supplied by the theme without having to mount anything.

And for anyone else stumbling across this, the referenced topic was created 6 years ago. Things have obviously changed a bit since then.

@jmooring: Thanks, you’re right!
I guess my knowledge in this corner is outdated a few years :wink:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.