diff --git a/material/base.html b/material/base.html
index be4e32990..7ccfc1ec4 100644
--- a/material/base.html
+++ b/material/base.html
@@ -182,19 +182,19 @@
{% set languages = lang.t("search.language").split(",") %}
{% if languages | length and languages[0] != "" %}
{% set path = "/assets/javascripts/lunr/" %}
-
+
{% for language in languages | map("trim") %}
{% if language != "en" %}
{% if language == "jp" %}
-
+
{% endif %}
{% if language in ("da", "de", "du", "es", "fi", "fr", "hu", "it", "jp", "no", "pt", "ro", "ru", "sv", "tr") %}
-
+
{% endif %}
{% endif %}
{% endfor %}
{% if languages | length > 1 %}
-
+
{% endif %}
{% endif %}
{% endif %}
diff --git a/src/base.html b/src/base.html
index 920bfb8bf..52c33d151 100644
--- a/src/base.html
+++ b/src/base.html
@@ -329,20 +329,20 @@
{% set languages = lang.t("search.language").split(",") %}
{% if languages | length and languages[0] != "" %}
{% set path = "/assets/javascripts/lunr/" %}
-
+
{% for language in languages | map("trim") %}
{% if language != "en" %}
{% if language == "jp" %}
-
+
{% endif %}
{% if language in ($md-lunr-languages$) %}
-
{% endif %}
{% endif %}
{% endfor %}
{% if languages | length > 1 %}
-
+
{% endif %}
{% endif %}
{% endif %}