I have a problem with images on a multilingual site in the list and single templates. English is set as the default language. The code is as follows: <img class="object-cover" src="{{ .RelPermalink }}{{ .Page.Params.mainImg }}" />
When I work with the default English, the image is requested from: http://localhost:13333/crypto/2024-05-06-tesla-accepts-dogecoin-payments/tesla_dogecoin.jpg
When I switch to Spanish, the request goes to the address with the language code es in the endpoint:
As far as I understand, it refers to the language subfolder. But in my case, all languages are located in the content/news/05/22/mynews folder. How do I take the path without the language code in the endpoint? How to get english path for image?
Even if they were duplicated, your approach of appending an image path to a page’s RelPermalink is, at best, fragile.
See this example:
git clone --single-branch -b hugo-forum-topic-49949 https://github.com/jmooring/hugo-testing hugo-forum-topic-49949
cd hugo-forum-topic-49949
hugo server
Dear Joe Mooring,
I would like to extend my heartfelt thanks for the incredible support you’ve provided throughout the project. Your expertise and guidance were instrumental in navigating the challenges we faced and ultimately led us to a successful resolution.
Your dedication to the project’s vision and your commitment to excellence have not only inspired me but have also made a significant impact on the project’s outcome. I am deeply grateful for your help.
Thank you once again for your invaluable assistance.