blob: 5dacc951b0419fe1d41e11d5d52b9129467ced39 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<!-- Takes a content (page, article,...) and translate it if possible-->
{% macro translate(content, sub_destination=None) -%}
{% if content.translations %}
Translations:
{% for translation in content.translations %}
{% if sub_destination %}
{% if sub_destination.endswith('/') %}
sub_destination = sub_destination[:-1]
{% endif %}
<a href="{{ SITEURL }}/{{ sub_destination }}/{{ translation.url }}">{{ translation.lang }}</a>
{% else %}
<a href="{{ SITEURL }}/{{ translation.url }}">{{ translation.lang }}</a>
{% endif %}
{% endfor %}
{% endif %}
{%- endmacro %}
|