kurtsson / jekyll-multiple-languages-plugin

I18n support for Jekyll and Octopress
MIT License
925 stars 202 forks source link

permalinks for the same page in other locales #71

Closed leobalter closed 8 years ago

leobalter commented 8 years ago

I would like to find the other available links for the current page I'm in. I'm not sure how I do it. I tried something like:

{% for lang in site.languages %}
  <pre>{% tl about lang %}</pre>
{% endfor %}

But this ends up applying lang as a string, and not passing lang as the variable name.

This might be more like a Liquid issue, but what I really need here is to find the links for the other locale versions of my current page.

There might be a way to solve this writing a custom plugin extending translate-link, but I first want to confirm there's nothing more simple through the template api.


Thanks for this great tool, all the other parts are working very well the documentation is very helpful.

Anthony-Gaudino commented 8 years ago

Hi @leobalter,

currently you can use the following code to do what you want:

{% for lang in site.languages %}
  {% capture about_link %} about {{ lang }} {% endcapture %}

  <pre>{% tl {{ about_link }} %}</pre>
{% endfor %}

I will make a small update on the code to allow expansions on the tags, so the following could be used:

{% for lang in site.languages %}
  <p>{% tl about {{ lang }} %}</p>
{% endfor %}

I will work on it right now, so when I finish it, I will let you know.

leobalter commented 8 years ago

Thank you, @Anthony-Gaudino! I'm looking forward this update.

Anthony-Gaudino commented 8 years ago

@leobalter, GEM version 1.5.0 was released and you should be able to use the shorter version of the code now.