jekyll-multiple-languages-plugin icon indicating copy to clipboard operation
jekyll-multiple-languages-plugin copied to clipboard

permalinks and language switcher example are incompatible

Open jinnatar opened this issue 8 years ago • 2 comments

As written the example language switcher doesn't work on pages that have a permalink, apparently regardless if there's a translated permalink or not. Current example for posterity:

{% if site.lang == "sv" %}
  {% capture link1 %}{{ site.baseurl_root }}en{{ page.url}}{% endcapture %}
  <a href="{{ link1 }}" >{% t global.english %}</a>
{% elsif site.lang == "en" %}
  {% capture link2 %}{{ site.baseurl_root }}{{ page.url  }}{% endcapture %}
  <a href="{{ link2 }}" >{% t global.swedish %}</a>
{% endif %}

In my example I have default lang en, secondary fi. If you click language switcher from default e.g. /help/ You will end up at: /help/fi/help/ Whereas the expected would be: /fi/help/ or if defining a permalink_fi: /apua/ then I would expect it to lead to /fi/apua/

So in short, the example switcher doesn't work with permalinks or translated permalinks and I couldn't fiddle it to work with them on my own.

jinnatar avatar Sep 07 '16 16:09 jinnatar

I have exactly the same existential question about switching between languages in a permalinked page.

Any suggestion about how to do that ?

dcram avatar Sep 23 '16 13:09 dcram

This works for me !

https://github.com/Anthony-Gaudino/jekyll-multiple-languages-plugin/pull/53

ghost avatar Nov 05 '16 16:11 ghost