Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Relative image paths are not handled properly in pages of secondary languages #1496

Open
yoching opened this issue Apr 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@yoching
Copy link

yoching commented Apr 19, 2024

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:

  1. On exampleSite branch of this repo, in content/posts/papermod/papermod-featuresdirectory, duplicate index.md and name it index.fa.md or index.fr.md
  2. Run hugo server from terminal
  3. Open the page (http://localhost:1313/hugo-PaperMod/posts/papermod/papermod-features/), check all the images are displayed
  4. 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.)
  5. Images in Regular Mode (default-mode) and Home-Info Mode sections 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
    Screenshot 2024-04-19 at 15 54 53

  • Fr or Fa page
    Screenshot 2024-04-19 at 15 54 41

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.

@yoching yoching added the bug Something isn't working label Apr 19, 2024
@adityatelange
Copy link
Owner

Hi @yoching hope you are setting proper baseURL for each language.

https://gohugo.io/content-management/multilingual/#configure-multilingual-multihost

@yoching
Copy link
Author

yoching commented Apr 26, 2024

In the hugo-PaperMod example site, base URLs are not set for each language, and root URLs for each language are these:

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?

@adityatelange
Copy link
Owner

@yoching do you think this might be related? gohugoio/hugo#8109

@yoching
Copy link
Author

yoching commented May 4, 2024

@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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants