switched async to defer; only load search js if search enabled

This commit is contained in:
Robert Clarke 2019-05-05 21:00:49 +00:00
parent 0a749bb620
commit e5b09a5d60

View file

@ -6,41 +6,38 @@
<head> <head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" <meta http-equiv="content-type" content="text/html; charset=utf-8">
content="text/html; charset=utf-8">
<!-- Enable responsiveness on mobile devices--> <!-- Enable responsiveness on mobile devices-->
<meta name="viewport" <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
content="width=device-width, initial-scale=1.0, maximum-scale=1">
<title> <title>
{% block title %}{{ config.title }}{% endblock title %} {% block title %}{{ config.title }}{% endblock title %}
</title> </title>
{% if config.extra.zulma_theme %} {% if config.extra.zulma_theme %}
<link rel="preload" as="style" <link rel="preload" as="style" href="{{ get_url(path=config.extra.zulma_theme ~ ".css", trailing_slash=false) }}" />
href="{{ get_url(path=config.extra.zulma_theme ~ ".css", trailing_slash=false) }}" />
{% else %} {% else %}
<link rel="preload" as="style" <link rel="preload" as="style" href="{{ get_url(path="default.css", trailing_slash=false) }}" />
href="{{ get_url(path="default.css", trailing_slash=false) }}" />
{% endif %} {% endif %}
{% if config.generate_rss %} {% if config.generate_rss %}
<link rel="alternate" type="application/rss+xml" <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml") | safe }}">
title="RSS"
href="{{ get_url(path="rss.xml") | safe }}">
{% endif %} {% endif %}
{% block css %} {% block css %}
{% if config.extra.zulma_theme %} {% if config.extra.zulma_theme %}
<link rel="stylesheet" <link rel="stylesheet" href="{{ get_url(path=config.extra.zulma_theme ~ ".css", trailing_slash=false) }}" />
href="{{ get_url(path=config.extra.zulma_theme ~ ".css", trailing_slash=false) }}" />
{% else %} {% else %}
<link rel="stylesheet" <link rel="stylesheet" href="{{ get_url(path="default.css", trailing_slash=false) }}" />
href="{{ get_url(path="default.css", trailing_slash=false) }}" />
{% endif %} {% endif %}
{% endblock css %} {% endblock css %}
{% if config.build_search_index %}
<script defer type="text/javascript" src="{{ get_url(path="elasticlunr.min.js") }}"></script>
<script defer type="text/javascript" src="{{ get_url(path="search_index.en.js") }}"></script>
{% endif }
{% block extra_head %} {% block extra_head %}
{% endblock extra_head %} {% endblock extra_head %}
@ -86,14 +83,12 @@
</div> </div>
</main> </main>
{% endblock content %} {% endblock content %}
<script async type="text/javascript"
src="{{ get_url(path="elasticlunr.min.js") }}"></script> <script type="text/javascript" src="{{ get_url(path="js/bulma.js") }}"></script>
<script async type="text/javascript"
src="{{ get_url(path="search_index.en.js") }}"></script> {% if config.build_search_index %}
<script async type="text/javascript" <script type="text/javascript" src="{{ get_url(path="js/search.js") }}"></script>
src="{{ get_url(path="js/bulma.js") }}"></script> {% endif %}
<script async type="text/javascript"
src="{{ get_url(path="js/search.js") }}"></script>
</body> </body>
</html> </html>