Only load Lunr languages that exist in theme

ref https://github.com/mmistakes/minimal-mistakes/pull/1445#issuecomment-355153434
This commit is contained in:
Michael Rose 2018-01-03 19:02:14 -05:00
parent 27d6774b25
commit 13ca7629b0

View file

@ -11,8 +11,14 @@
<script src="{{ '/assets/js/main.min.js' | absolute_url }}"></script>
{% endif %}
{% if site.search == true or page.layout == 'search' %}
{% if site.search == true or page.layout == "search" %}
{% assign lang = site.locale | slice: 0,2 | default: "en" %}
{% case lang %}
{% when "gr" %}
{% assign lang = "gr" %}
{% else %}
{% assign lang = "en" %}
{% endcase %}
<script src="{{ '/assets/js/lunr.min.js' | absolute_url }}"></script>
<script src="{{ '/assets/js/lunr-' | append: lang | append: '.js' | absolute_url }}"></script>
{% endif %}