hugo-PaperMod
hugo-PaperMod copied to clipboard
[BUG] Relative image paths are not handled properly in pages of secondary languages
Describe the bug
- Device/Os: MacBookAir Sonoma 14.4
- Type: Desktop/Mobile (HTML itself)
- Browser and version [e.g. Chrome 86.0]: Any browser
- Hugo Version [ >=0.112.4 expected]: 0.125.1
- Theme Version [e.g. v4.0, master, or commit-id ]: master (aa7905e)
Steps to reproduce the behavior:
- On
exampleSitebranch of this repo, incontent/posts/papermod/papermod-featuresdirectory, duplicateindex.mdand name itindex.fa.mdorindex.fr.md - Run
hugo serverfrom terminal - Open the page (http://localhost:1313/hugo-PaperMod/posts/papermod/papermod-features/), check all the images are displayed
- Open the same page in other languages. http://localhost:1313/hugo-PaperMod/fr/posts/papermod/papermod-features/ or http://localhost:1313/hugo-PaperMod/fa/posts/papermod/papermod-features/ (You can also click Translations : 🇫🇷 or Fa under the post title.)
- Images in
Regular Mode (default-mode)andHome-Info Modesections are not shown
Expected behavior: The images should appear regardless of languages. (This used to work before. I'm not sure from which version this behavior was changed.)
Repo/Source where this issue can be reproduced:
I updated the example-site and pushed to forked repo here.
https://github.com/yoching/hugo-PaperMod/tree/exampleSite-image-language
(But it's only duplicating index.md. No content change)
Screenshots
-
English page
-
Fr or Fa page
Additional context
I first realized that images are not shown on my website, which has English and Japanese pages. I was able to reproduce it with the example site of this repository. Until about half a year ago (I can't remember exactly), the images appeared without problem.
Hi @yoching hope you are setting proper baseURL for each language.
https://gohugo.io/content-management/multilingual/#configure-multilingual-multihost
In the hugo-PaperMod example site, base URLs are not set for each language, and root URLs for each language are these:
- EN: https://adityatelange.github.io/hugo-PaperMod/
- FR: https://adityatelange.github.io/hugo-PaperMod/fr/
- FA: https://adityatelange.github.io/hugo-PaperMod/fa/
I tried setting these as the baseURL for each language. However, with the setting, now common assets (e.g. css) are not handled properly, then FR or FA sites become broken (no CSS).
Are there any ways to avoid this?
@yoching do you think this might be related? https://github.com/gohugoio/hugo/issues/8109
@adityatelange
No, adding absLangURL doesn't solve the stylesheet issue.
I'm not sure if adding baseURL is a good idea in this case, as multiple language sites are configured on these endpoints:
EN: https://adityatelange.github.io/hugo-PaperMod/ FR: https://adityatelange.github.io/hugo-PaperMod/fr/ FA: https://adityatelange.github.io/hugo-PaperMod/fa/
@yoching looks like this issue is related to #1504
- https://github.com/adityatelange/hugo-PaperMod/issues/1504#issuecomment-2117491255