aboutsummaryrefslogtreecommitdiffstats
path: root/syte/templates/translations.html
blob: 2a83aa780dd812eab794f964e6ecd66727520c9a (plain)
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 %}
    Also available in: 
        {% 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 %}