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' %}
<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' %}
<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 %}
<!-- MathJax -->
<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 %}
{% elsif page.layout == 'page' %}
{% 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 %}
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
<script async src="{{ '/assets/js/page.min.js' | relative_url }}"></script>
{% endif %}
{% else %}
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
<script async src="{{ '/assets/js/page.min.js' | relative_url }}"></script>
{% endif %}
{% if jekyll.environment == 'production' %}
{% include google-analytics.html %}
<!-- PWA -->
<script src="{{ '/app.js' | relative_url }}" defer></script>
<script defer src="{{ '/app.js' | relative_url }}"></script>
{% endif %}

View File

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