Populating translated pages with default language front matter?

I’m curious if there is a way to have the default content language serve as the primary source of frontmatter for translated pages. Use the following two files as an example:


post.md

+++
title = "Hello World"
description = "An example post."
author = "Victor Hugo"
date = "06-13-2020"
image  = "img/cat.jpg"
+++

This is an example post to demonstrate my example.

post.fr.md

+++
title = "Bonjour le Monde"
description = "Un exemple de message."
+++

Ceci est un exemple de message pour illustrer mon exemple.

Conceptually, I am looking for the page at example.com/fr/posts/post to appear as though it has the following markdown file:


+++
title = "Bonjour le Monde"
description = "Un exemple de message."
author = "Victor Hugo"
date = "06-13-2020"
image  = "img/cat.jpg"
+++

Ceci est un exemple de message pour illustrer mon exemple.

This seems to make sense to me as the date can be adjusted via i18n, the author’s name is only really effected by the alphabet used, not the language, and the image is probably not language-specific.

Am I missing something in the docs? Is this possible?

Thanks!

1 Like

May be you can try to have a cascade in your section/folder/whatever is level up your pages.

[cascade]
  author = "Victor Hugo"
  image  = "img/cat.jpg"
1 Like

I had forgotten about cascade. I’m going to guess that is the best solution.

I assume that would require reformatting the directories?

content/posts/post.md -> content/posts/post/index.md
content/posts/post.fr.md -> content/posts/post/index.fr.md

This works, but is a little different that what I had envisioned.


Using cascade forces you to increase your directory complexity and transition from title.md to the less descriptive, and semantically ambiguous, index.md. I am guessing my assumption of how Hugo processes multiple languages is probably different than reality. I assumed that it acknowledged at some point that post.md and post.fr.md were the same piece of content, but translated, so it would be possible to use the data from one for the other.

May I ask why you want to do this? If I was doing this, I would simply open the English version, change some of the front matter (title and description), translate the content, then resave it as the French page. Then you have the frontmatter you need.

???

While that’s simple in theory, in practice it is not ideal as you are adding redundant data. If you change anything, you now have to change it in both places. For example, in you needed to adjust an author’s name (which doesn’t typically have translations) for some reason, you now have to change it in both places. This increases the chances of forgetting to change it in the other, and/or having variations among pages.

1 Like

I know that this question is old, but in case someone else is looking for the answer: In multilingual sites, I only include the content that needs translation in the markdown files, and the rest go to data files so that there’s only one copy of them for all languages.