Multilingual content shared params

Suppose I have a multilingual site with a post in two languages, so I have these content files: post.en.md and post.es.md

Now, I have some params in each file that are duplicated. Is there a way to set them once without copying them in each content file?

Not than I know of. It’s a feature I would wish for and considering Page Bundles are merged among translations it may not be such a far stretch to implement: a translations front matter merge/inheritance … it may bear some unforseen side effect though…

In the mean time you could do it in your template.

Test for a Param and if not found get its trlanslarion using the very recently improved (today) .GetPage. Then get the Param of its translations.

Thanks. That’s a good workaround.

Depending on the params, data templates, might work.

Yeah that my current approach but it’s quite cumbersome. It would be much easier if the translation pages inherited the default lang params.

I proposed a new future discussion here: https://discourse.gohugo.io/t/request-make-page-translation-inherit-default-lang-params-and-content-that-it-doesnt-contain/13121/2

2 Likes