Seek help with multilingual support

I’ve recently added multilingual support to my blog, now featuring English (default) and Chinese. However, a few issues have come up, and I’d love some assistance!

Image URLs Not Working Properly

It seems that posts in different languages should automatically share images, but as shown here, the Chinese version of this post isn’t displaying images correctly, while the English version works fine. You can view the code for both versions here.

“Blogs” Label in Chinese List

On the page listing the Chinese blog posts, the label still reads “Blogs” in English. Is there a way to change this, or would it require overriding the theme?

The PaperMod theme is unable to handle page resources properly on multilingual single-host sites. It has its own incompatible image render hook.

See https://github.com/adityatelange/hugo-PaperMod/pull/1526. It’s been open for four months.

You can override the theme’s image render hook:

mkdir -p layouts/_default/markup
touch layouts/_default/markup/render-image.html

Then copy Hugo’s embedded image render hook code into the file you just created.

If you want to control the section title for the blogs section:

hugo new content content/blog/_index.md
hugo new content content/blog/_index.zh.md

Then edit both files as needed, making sure you set draft to false.

1 Like

Thanks. I have resolved the second issue. However, the first remains. I added the file you suggested. See here It does not seem to have any effect though.

I apologize. I mistyped the commands above. The markup directory should be _markup.

layouts/
└── _default/
    └── _markup/
        └── render-image.html

This works. Thank!

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