From c703581abd06fcd79def10fbbb412c42edf1be1d Mon Sep 17 00:00:00 2001 From: jultty Date: Tue, 20 Aug 2024 02:29:09 -0300 Subject: [PATCH] Display language toggle only if translation exists --- templates/base.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/templates/base.html b/templates/base.html index 5132091..b4a3ab3 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,9 +1,14 @@ +{% if page %} + {% set translation_count = page.translations | length %} +{% elif section %} + {% set translation_count = section.translations | length %} +{% endif %} {% if lang == "pt" %} -{% else %} + {% else %} -{% endif %} + {% endif %} @@ -74,10 +79,14 @@ {% endif %}{% endif %} + {% if current_path and translation_count > 1 %} + {% set english_path = current_path | regex_replace(pattern="^/pt", rep="") %}
Language icon{% if lang == "pt" %}EN{% else %}PT {% endif %}
+ {% endif %} +
{% block content %} {% endblock %}