Avoid GA snippet blocking HTML parsing.

This commit is contained in:
Cotes Chung 2020-10-27 20:57:59 +08:00
parent 8d4c1deb15
commit 7d128769f6
2 changed files with 11 additions and 11 deletions

View file

@ -8,38 +8,34 @@
{% if page.layout == 'home' %} {% if page.layout == 'home' %}
<script src="{{ '/assets/js/home.min.js' | relative_url }}" async></script> <script async src="{{ '/assets/js/home.min.js' | relative_url }}"></script>
{% elsif page.layout == 'post' %} {% elsif page.layout == 'post' %}
<script src="{{ '/assets/js/post.min.js' | relative_url }}" async></script> <script async src="{{ '/assets/js/post.min.js' | relative_url }}"></script>
{% if page.math %} {% if page.math %}
<!-- MathJax --> <!-- MathJax -->
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" async></script> <script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
{% endif %} {% endif %}
{% elsif page.layout == 'page' %} {% elsif page.layout == 'page' %}
{% if page.type == 'categories' %} {% if page.type == 'categories' %}
<script src="{{ '/assets/js/categories.min.js' | relative_url }}" async></script> <script async src="{{ '/assets/js/categories.min.js' | relative_url }}"></script>
{% else %} {% else %}
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script> <script async src="{{ '/assets/js/page.min.js' | relative_url }}"></script>
{% endif %} {% endif %}
{% else %} {% else %}
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script> <script async src="{{ '/assets/js/page.min.js' | relative_url }}"></script>
{% endif %} {% endif %}
{% if jekyll.environment == 'production' %} {% if jekyll.environment == 'production' %}
{% include google-analytics.html %}
<!-- PWA --> <!-- PWA -->
<script src="{{ '/app.js' | relative_url }}" defer></script> <script defer src="{{ '/app.js' | relative_url }}"></script>
{% endif %} {% endif %}

View file

@ -54,6 +54,10 @@ layout: compress
{% include search-loader.html %} {% include search-loader.html %}
{% if site.google_analytics.id and jekyll.environment == 'production' %}
{% include google-analytics.html %}
{% endif %}
</body> </body>
</html> </html>