Closed johBerlin closed 4 years ago
Instead of that can you try simply wrapping the url in the url function? {{ url(lang_url) }}
nope. doesn't work with url() function. What would be the benefit?
I can also say about the bug: I run a bilingual page ... it adds a tailing slash to the other language in the hrefang tag. Not the one of the current page. Thus, I believe the tailing slash is related to the construction of the alternative hreflang tag:
{% set lang_url = base_url_simple ~ langobj.getLanguageURLPrefix(key) ~ langswitcher.page_route ~ page.urlExtension ?: '/' %}
Am I understanding this right: It adds a tailing slash if page.urlExtension is false?
If that is the case, why don't we make it a parameter in the plugin settings. Like "use tailing slashes true/false". Then everybody can decide on how to run urls.
I'll close this one then.
I have the problem, that tailing slashes are in hreflang tags are different for some languages. I changes the hreflang-twig so it would trim the tailing slash for the url:
<link rel="alternate" hreflang="{{ key }}" href="{{ rtrim(lang_url,"/") ~ uri.params }}" />
Now it works.