aboutsummaryrefslogtreecommitdiffstats
path: root/syte/templates/translations.html
diff options
context:
space:
mode:
Diffstat (limited to 'syte/templates/translations.html')
-rw-r--r--syte/templates/translations.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/syte/templates/translations.html b/syte/templates/translations.html
new file mode 100644
index 0000000..2a83aa7
--- /dev/null
+++ b/syte/templates/translations.html
@@ -0,0 +1,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 %}