3685685b28
- Easy to switch between different CDN - Allow self-host static assets
100 lines
2.9 KiB
HTML
100 lines
2.9 KiB
HTML
<!--
|
|
JS selector for site.
|
|
-->
|
|
|
|
<!-- layout specified -->
|
|
|
|
{% if page.layout == 'post' %}
|
|
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
|
|
<!-- pv-report needs countup.js -->
|
|
<script async src="{{ site.data.assets[origin].countup.js }}"></script>
|
|
<script defer src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if page.layout == 'post' or page.layout == 'page' %}
|
|
<!-- image lazy-loading & popup & clipboard -->
|
|
{% assign _urls = site.data.assets[origin].magnific-popup.js
|
|
| append: ',' | append: site.data.assets[origin].lozad.js
|
|
| append: ',' | append: site.data.assets[origin].clipboard.js
|
|
%}
|
|
|
|
{% include jsdelivr-combine.html urls=_urls %}
|
|
|
|
{% endif %}
|
|
|
|
{% if page.layout == 'home'
|
|
or page.layout == 'post'
|
|
or page.layout == 'archives'
|
|
or page.layout == 'category'
|
|
or page.layout == 'tag' %}
|
|
|
|
{% if site.prefer_datetime_locale %}
|
|
{% assign locale = site.prefer_datetime_locale | downcase %}
|
|
{% else %}
|
|
{% assign locale = site.lang | split: '-' | first %}
|
|
{% endif %}
|
|
|
|
{% assign _urls = site.data.assets[origin].dayjs.js.common
|
|
| append: ',' | append: site.data.assets[origin].dayjs.js.locale
|
|
| replace: ':LOCALE', locale
|
|
| append: ',' | append: site.data.assets[origin].dayjs.js.relativeTime
|
|
| append: ',' | append: site.data.assets[origin].dayjs.js.localizedFormat
|
|
%}
|
|
|
|
{% include jsdelivr-combine.html urls=_urls %}
|
|
|
|
{% endif %}
|
|
|
|
{% if page.layout == 'home'
|
|
or page.layout == 'categories'
|
|
or page.layout == 'post'
|
|
or page.layout == 'page' %}
|
|
{% assign type = page.layout %}
|
|
{% elsif page.layout == 'archives'
|
|
or page.layout == 'category'
|
|
or page.layout == 'tag' %}
|
|
{% assign type = "misc" %}
|
|
{% else %}
|
|
{% assign type = "commons" %}
|
|
{% endif %}
|
|
|
|
{% capture script %}/assets/js/dist/{{ type }}.min.js{% endcapture %}
|
|
<script defer src="{{ script | relative_url }}"></script>
|
|
|
|
{% if page.math %}
|
|
<!-- MathJax -->
|
|
<script>
|
|
/* see: <https://docs.mathjax.org/en/latest/options/input/tex.html#tex-options> */
|
|
MathJax = {
|
|
tex: {
|
|
inlineMath: [ /* start/end delimiter pairs for in-line math */
|
|
['$','$'],
|
|
['\\(','\\)']
|
|
],
|
|
displayMath: [ /* start/end delimiter pairs for display math */
|
|
['$$', '$$'],
|
|
['\\[', '\\]']
|
|
]
|
|
}
|
|
};
|
|
</script>
|
|
<script src="{{ site.data.assets[origin].polyfill.js }}"></script>
|
|
<script id="MathJax-script" async src="{{ site.data.assets[origin].mathjax.js }}">
|
|
</script>
|
|
{% endif %}
|
|
|
|
<!-- commons -->
|
|
|
|
<script src="{{ site.data.assets[origin].bootstrap.js }}"></script>
|
|
|
|
{% if jekyll.environment == 'production' %}
|
|
<!-- PWA -->
|
|
<script defer src="{{ '/app.js' | relative_url }}"></script>
|
|
|
|
<!-- GA -->
|
|
{% if site.google_analytics.id != empty and site.google_analytics.id %}
|
|
{% include google-analytics.html %}
|
|
{% endif %}
|
|
|
|
{% endif %}
|