aboutsummaryrefslogtreecommitdiffstats
path: root/syte/templates/translations.html
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2012-11-20 15:27:59 -0800
committerAlexis Metaireau <alexis@notmyidea.org>2012-11-20 15:27:59 -0800
commit2f89e783273a2ed72cb611771056319500c454e8 (patch)
tree4a2e76f9cbaecc97afadc96930a7c410a0d2a606 /syte/templates/translations.html
parentf9fd2f5c414fab9a3230e69b9370918eddcf2e5b (diff)
parent3ffd14fa4da0ca71e1f97a070973e4994bae8f61 (diff)
downloadpelican-themes-2f89e783273a2ed72cb611771056319500c454e8.tar.gz
Merge pull request #55 from arnaudbos/master
Fix syte social integration
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 %}