I have opened an issue on Git about localising BaseURL
From the feedback I got there it seems I’m doing something wrong.
Neither {{.Site.BaseURL}} nor {{ .Site.BaseURL | absLangURL}} seem to return the base url localised with the current language.
Thank you for your reply.
I checked the docs and it says the following:
If the default language needs to be rendered below its own language code ( /en ) like the others, set defaultContentLanguageInSubdir: true .
I’m not sure if this is the problem I have. I also tried it and it didn’t seem to fix the issue.
Here are the current scenarios:
If I’m at http://localhost:1313/pt-pt/about and click {{ .Site.BaseURL | absLangURL}} I expect to be forwarded to http://localhost:1313/pt-pt
If I’m at http://localhost:1313/about and click {{ .Site.BaseURL | absLangURL}}, I expect to be forwarded to http://localhost:1313/
The behaviour works just as I described if I use {{ "/" | absLangURL}} but not if I have:
baseURL = "/"
and do {{ .Site.BaseURL | absLangURL}}
I mean I can currently go around this easily, but I feel that this is a bug and maybe should be considered for fix. But the issue has been closed on the premise that it’s expected behaviour, and I wonder if there’s something that I’m overlooking.
I hope this clarifies the issue, and thank you again for your reply
Edit: A bit more clarification on why your proposed solution didn’t work for me, this is what happens:
If I’m at http://localhost:1313/pt-pt/about and click {{ .Site.BaseURL | absLangURL}} I expect to be forwarded to http://localhost:1313/pt-pt but I get forwarded to http://localhost:1313/en-gb/ instead