diff --git a/README.rst b/README.rst index e5c5b40..27addae 100644 --- a/README.rst +++ b/README.rst @@ -9,6 +9,11 @@ pending pull requests from that repository and also merged new features from Changelog --------- +2nd Jul 2016 + +- Add support for article and page translations. Fixes + `issue #89 `_ + 21st May 2016 - Add ``DISPLAY_SOCIAL_ICONS`` setting and the ``social_icons`` sidebar diff --git a/templates/_includes/article.html b/templates/_includes/article.html index 227d346..e3c48c5 100644 --- a/templates/_includes/article.html +++ b/templates/_includes/article.html @@ -11,6 +11,9 @@

{{ article.title|striptags }}

{% include '_includes/article_time.html' %} {% include '_includes/article_stats.html' %} {% if SHOW_DISQUS_COMMENT_COUNT and DISQUS_SITENAME %} | Comments{% endif %} + {% import 'translations.html' as translations with context %} + {% if article.translations %} | {% endif %} + {{ translations.translations_for(article) }}

diff --git a/templates/page.html b/templates/page.html index 8b244f7..92db50e 100644 --- a/templates/page.html +++ b/templates/page.html @@ -6,6 +6,10 @@
{% include '_includes/qr_code.html' %}

{{ page.title }}

+

+ {% import 'translations.html' as translations with context %} + {{ translations.translations_for(page) }} +

{{ page.content }} diff --git a/templates/translations.html b/templates/translations.html new file mode 100644 index 0000000..d3e01c9 --- /dev/null +++ b/templates/translations.html @@ -0,0 +1,8 @@ +{% macro translations_for(article) %} +{% if article.translations %} +Translations: + {% for translation in article.translations %} + {{ translation.lang }}{% if not loop.last %}, {% endif %} + {% endfor %} +{% endif %} +{% endmacro %}