Site not generating URLs that start with language code
hugo v0.82.0+extended darwin/amd64 BuildDate=unknown
I tend to have my website in Polish and I added English version in my local development.
When config.toml contain only one language pl there was not issue with generating posts URL's.
When I added English language along with Polish, where Polish is in / and only english in /en/, posts with URL starting with language code doesn't generate.
for example, post with
url: '/placek-wloski/'
will not generate, because contain /pl on front (!) despite that DefaultContentLanguage = "pl" is set and Polish site is not served in /pl/ folder
I can change on same post URL to, lets say /xxplacek-wloski/ and it will open correctly because /pl is not on front of URL
I can confirm that issue is existing with English part of the website that by default have /en/ set.
For example:
url: '/test-post/'
will work on localhost:1314/en/test-post/
however if you change it to url: '/entest-post/'
it will not work, as contain /en on front.
Removing all reference to languages from config [languages.xxxxx] revert site to solo-language and all links working fine.
Adding disableLanguages doesn't fix the issue, only removing [languages] part all together.
Through further investigation, the issue happening when each language got set its own baseURL.
Example
[languages]
[languages.pl]
baseURL = "https://dariusz.wieckiewicz.org/"
(...)
[languages.en]
baseURL = "https://dariusz.wieckiewicz.org/en/"
(...)
Temporary solution.
Change language names
DefaultContentLanguage = "polish" instead pl (and because of that i18n need to renamed from pl.toml to polish.toms along with config parts [languages.pl] to [languages.polish].
This will allow me to generate posts that URL start with /pl... as long as not starting with /polish...
still, if I want English to be in /en need to avoid starting my post url with /en... for English language (this doesn't affect other language).
The issue happens only, when in [languages] each language got specified baseURL.
Related to or duplicate of:
- #7907
- #7733
Related to or duplicate of:
- #7907
- #7733
It looks like, worth to merge them some point.
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.