web/_includes/js-selector.html
Cotes Chung 46c2cfe64e Improved the page recognition.
Useful for label localization
2020-06-30 17:39:14 +08:00

49 lines
1.4 KiB
HTML

<!--
JS selector for site.
Chirpy v2.3
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT Licensed
-->
{% if page.layout == 'home' %}
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
<script src="{{ '/assets/js/data/pv-cache.js' | relative_url }}"></script>
{% endif %}
<script src="{{ '/assets/js/home.min.js' | relative_url }}" async></script>
{% elsif page.layout == 'post' %}
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
<script src="{{ '/assets/js/data/pv-cache.js' | relative_url }}"></script>
{% endif %}
<script src="{{ '/assets/js/post.min.js' | relative_url }}" async></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>
{% endif %}
{% elsif page.layout == 'page' %}
{% if page.type == 'categories' %}
<script src="{{ '/assets/js/categories.min.js' | relative_url }}" async></script>
{% else %}
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
{% endif %}
{% else %}
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
{% endif %}
<!-- PWA -->
{% if jekyll.environment == 'production' %}
<script src="{{ '/app.js' | relative_url }}" defer></script>
{% endif %}