Skip to content

Commit 7cefb94

Browse files
committed
20240905 update goatcounter
1 parent 579aa2a commit 7cefb94

File tree

2 files changed

+122
-1
lines changed

2 files changed

+122
-1
lines changed

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ google_analytics:
5353
id: G-0T2CPZCLYK # fill in your Google Analytics ID
5454

5555
goatcounter:
56-
id: # fill in your Goatcounter ID
56+
id: ymzhang # fill in your Goatcounter ID
5757

5858
# Prefer color scheme setting.
5959
#

_includes/js-selector.html

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<!-- JS selector for site. -->
2+
3+
<!-- commons -->
4+
5+
{% assign urls = site.data.origin[type].search.js %}
6+
7+
<!-- layout specified -->
8+
9+
{% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %}
10+
{% assign urls = urls | append: ',' | append: site.data.origin[type]['lazy-polyfill'].js %}
11+
12+
{% unless page.layout == 'home' %}
13+
<!-- image lazy-loading & popup & clipboard -->
14+
{% assign urls = urls
15+
| append: ','
16+
| append: site.data.origin[type].glightbox.js
17+
| append: ','
18+
| append: site.data.origin[type].clipboard.js
19+
%}
20+
{% endunless %}
21+
{% endif %}
22+
23+
{% if page.layout == 'home'
24+
or page.layout == 'post'
25+
or page.layout == 'archives'
26+
or page.layout == 'category'
27+
or page.layout == 'tag'
28+
%}
29+
{% assign locale = include.lang | split: '-' | first %}
30+
31+
{% assign urls = urls
32+
| append: ','
33+
| append: site.data.origin[type].dayjs.js.common
34+
| append: ','
35+
| append: site.data.origin[type].dayjs.js.locale
36+
| replace: ':LOCALE', locale
37+
| append: ','
38+
| append: site.data.origin[type].dayjs.js.relativeTime
39+
| append: ','
40+
| append: site.data.origin[type].dayjs.js.localizedFormat
41+
%}
42+
{% endif %}
43+
44+
{% if page.content contains '<h2' or page.content contains '<h3' and site.toc and page.toc %}
45+
{% assign urls = urls | append: ',' | append: site.data.origin[type].toc.js %}
46+
{% endif %}
47+
48+
{% if page.mermaid %}
49+
{% assign urls = urls | append: ',' | append: site.data.origin[type].mermaid.js %}
50+
{% endif %}
51+
52+
{% include jsdelivr-combine.html urls=urls %}
53+
54+
{% case page.layout %}
55+
{% when 'home', 'categories', 'post', 'page' %}
56+
{% assign js = page.layout %}
57+
{% when 'archives', 'category', 'tag' %}
58+
{% assign js = 'misc' %}
59+
{% else %}
60+
{% assign js = 'commons' %}
61+
{% endcase %}
62+
63+
{% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %}
64+
65+
<script src="{{ script | relative_url }}"></script>
66+
67+
{% if page.math %}
68+
<!-- MathJax -->
69+
<script src="{{ '/assets/js/data/mathjax.js' | relative_url }}"></script>
70+
<script type="text/x-mathjax-config">
71+
MathJax.Hub.Config({
72+
tex2jax: {
73+
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'],
74+
inlineMath: [['$','$'], ['\\(','\\)']],
75+
processEscapes: true
76+
},
77+
TeX: {
78+
equationNumbers: {
79+
autoNumber: "AMS"
80+
}
81+
}
82+
});
83+
</script>
84+
<script type="text/javascript" async
85+
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS_CHTML">
86+
</script>
87+
{% endif %}
88+
89+
<!-- Pageviews -->
90+
{% if page.layout == 'post' %}
91+
{% assign provider = site.pageviews.provider %}
92+
93+
{% if provider and provider != empty %}
94+
{% case provider %}
95+
{% when 'goatcounter' %}
96+
{% if site.analytics[provider].id != empty and site.analytics[provider].id %}
97+
{% include pageviews/{{ provider }}.html %}
98+
{% endif %}
99+
{% endcase %}
100+
{% endif %}
101+
{% endif %}
102+
103+
{% if page.mermaid %}
104+
{% include mermaid.html %}
105+
{% endif %}
106+
107+
{% if jekyll.environment == 'production' %}
108+
<!-- PWA -->
109+
{% if site.pwa.enabled %}
110+
<script defer src="{{ 'app.min.js' | relative_url }}"></script>
111+
{% endif %}
112+
113+
<!-- Web Analytics -->
114+
{% for analytics in site.analytics %}
115+
{% capture str %}{{ analytics }}{% endcapture %}
116+
{% assign type = str | split: '{' | first %}
117+
{% if site.analytics[type].id and site.analytics[type].id != empty %}
118+
{% include analytics/{{ type }}.html %}
119+
{% endif %}
120+
{% endfor %}
121+
{% endif %}

0 commit comments

Comments
 (0)