Files
pelican-themes/syte/templates/translations.html
2012-10-20 02:52:02 +02:00

17 lines
718 B
HTML

<!-- 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 %}