canonicalpath not the best way to find lang?
Open
- Dominant language
- PHP
- Stars
- 45
- Forks
- 189
- PR merge metrics
- No merged PRs in 30d
Description
in https://docs.bolt.cm/2.2/howto/building-multilingual-websites#making-templates-and-fetching-content
we can find this :
{% if app.canonicalpath %}
{% set languageslug = app.canonicalpath|split('/')[1] %}
{% else %}
{% set languageslug = app.paths.current|split('/')[1] %}
{% endif %}
but it doesn't work if we host the site in a subfolder, like www.site.com/eventsite_subfolder/nl/index.php, as it will always return languageslug="eventsite_subfolder"
I'd rather use :
{% set languageslug = app.request.uri|split(paths.root)[1]|split("/")|first %}
ugly but works better :)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.