Multilingual post with the same image for all translations

Hello,

I’ve read Multilingual mode | Hugo and the various related topics here, notably Share images between multilingual posts - #2 by jmooring, which seemed to be the answer to my question, but I’m apparently unable to make it work.

I am creating a multilingual (currently, en and fr) site, using file-based translations and with the en and fr contents being put in subdirectories under the main url (e.g. http://example.com/en/...) and in several cases, a post has FR and EN translations and features an image. The image is the same for both languages. I expected I could obtain what I want with

content \
  posts\
    my-post\
      index.md (or index.en.md)
      index.fr.md
      my-image.jpg

Where index.md / index.en.md contains

![Some description](my-image.jpg)

and index.fr.md contains

![Une description](my-image.jpg)

I’d expected both posts to show the image, except only the en shows it, because in the static site, the img tags’ src attribute is just "my-image.jpg", but the my-image.jpg file exists only on the en/ side.

What am I doing wrong?

Assuming our config is correctly setup I guess you have an active render-image hook active. Either your own or provided by a module/theme you are using.

Have a look at this section in the docs about multilingual page resources.

And here’s an answer ofor another topic with some details: Multilanguage support and non-localized images - #2 by jmooring

That was it! Not in my own code, but in the PaperMod theme. More precisely:

  1. wp2hugo generates a non-git version of the PaperMod theme, and
  2. PaperMod’s render-image is known to have an issue with shared resources in multilingual mode and there is a pull request open Use new 'Image render hook' template from Hugo. by adityatelange · Pull Request #1526 · adityatelange/hugo-PaperMod · GitHub

Thanks a lot!

[EDITed mostly to clarify the cause of the issue]

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