Skip to content

Commit b9d053b

Browse files
committed
Merge branch 'master' into production
2 parents ba764c1 + cd258c9 commit b9d053b

32 files changed

+305
-185
lines changed

.github/codeql/codeql-config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
paths-ignore:
2+
- "assets/js"

.github/dependabot.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ updates:
77
bundler:
88
dependency-type: "production"
99
schedule:
10-
interval: "monthly"
10+
interval: "weekly"
1111
- package-ecosystem: "npm"
1212
directory: "/"
1313
versioning-strategy: increase
1414
groups:
1515
npm:
1616
dependency-type: "development"
1717
schedule:
18-
interval: "monthly"
18+
interval: "weekly"
1919
- package-ecosystem: "github-actions"
2020
directory: "/"
2121
groups:
2222
gh-actions:
2323
update-types:
2424
- "major"
2525
schedule:
26-
interval: "monthly"
26+
interval: "weekly"

.github/workflows/codeql.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ name: "CodeQL"
22

33
on:
44
push:
5-
paths: ["**.js"]
5+
paths: ["_javascript/**/*.js"]
66
pull_request:
7-
paths: ["**.js"]
8-
schedule:
9-
- cron: "0 0 * * 5"
7+
paths: ["_javascript/**/*.js"]
108

119
jobs:
1210
analyze:
@@ -32,6 +30,7 @@ jobs:
3230
uses: github/codeql-action/init@v3
3331
with:
3432
languages: "${{ matrix.language }}"
33+
config-file: .github/codeql/codeql-config.yml
3534

3635
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
3736
# If this step fails, then you should remove it and run the build manually (see below)

.github/workflows/stale.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
steps:
2323
- uses: actions/stale@v9
2424
with:
25-
days-before-stale: 30
26-
days-before-close: 1
25+
# 60 days before marking issues/PRs stale
26+
days-before-close: -1 # does not close automatically
2727
stale-issue-label: ${{ env.STALE_LABEL }}
2828
exempt-issue-labels: ${{ env.EXEMPT_LABELS }}
2929
stale-issue-message: ${{ env.MESSAGE }}

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package-lock.json
1616

1717
# IDE configurations
1818
.idea
19-
.vscode
2019

2120
# Misc
2221
assets/js/dist

.husky/commit-msg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npx --no -- commitlint -x $(npm root -g)/@commitlint/config-conventional --edit
4+
npx --no -- commitlint --edit ${1}

.vscode/extensions.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"recommendations": [
3+
// Liquid tags auto-complete
4+
"killalau.vscode-liquid-snippets",
5+
// Liquid syntax highlighting and formatting
6+
"Shopify.theme-check-vscode",
7+
// Common formatter
8+
"esbenp.prettier-vscode",
9+
"foxundermoon.shell-format",
10+
"stylelint.vscode-stylelint"
11+
]
12+
}

.vscode/settings.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
// Prettier
3+
"editor.defaultFormatter": "esbenp.prettier-vscode",
4+
"editor.formatOnSave": true,
5+
"prettier.trailingComma": "none",
6+
// Shopify Liquid
7+
"files.associations": {
8+
"*.html": "liquid"
9+
},
10+
// Formatter
11+
"[html][liquid]": {
12+
"editor.defaultFormatter": "Shopify.theme-check-vscode"
13+
},
14+
"[shellscript]": {
15+
"editor.defaultFormatter": "foxundermoon.shell-format"
16+
},
17+
// Disable vscode built-in stylelint
18+
"css.validate": false,
19+
"scss.validate": false,
20+
"less.validate": false,
21+
// Stylint extension settings
22+
"stylelint.snippet": ["css", "less", "postcss", "scss"],
23+
"stylelint.validate": ["css", "less", "postcss", "scss"]
24+
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
- Built-in Search
3535
- Atom Feeds
3636
- PWA
37-
- Google Analytics
37+
- Google Analytics / GoatCounter
3838
- SEO & Performance Optimization
3939

4040
## Documentation

_config.yml

+13-7
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ google_site_verification: # fill in to your verification string
5252
google_analytics:
5353
id: # fill in your Google Analytics ID
5454

55+
goatcounter:
56+
id: # fill in your Goatcounter ID
57+
5558
# Prefer color scheme setting.
5659
#
5760
# Note: Keep empty will follow the system prefer color by default,
@@ -63,7 +66,7 @@ google_analytics:
6366
# light - Use the light color scheme
6467
# dark - Use the dark color scheme
6568
#
66-
theme_mode: # [light|dark]
69+
theme_mode: # [light | dark]
6770

6871
# The CDN endpoint for images.
6972
# Notice that once it is assigned, the CDN url
@@ -108,10 +111,17 @@ assets:
108111
enabled: # boolean, keep empty means false
109112
# specify the Jekyll environment, empty means both
110113
# only works if `assets.self_host.enabled` is 'true'
111-
env: # [development|production]
114+
env: # [development | production]
112115

113116
pwa:
114-
enabled: true # the option for PWA feature
117+
enabled: true # the option for PWA feature (installable)
118+
cache:
119+
enabled: true # the option for PWA offline cache
120+
# Paths defined here will be excluded from the PWA cache.
121+
# Usually its value is the `baseurl` of another website that
122+
# shares the same domain name as the current website.
123+
deny_paths:
124+
# - "/example" # URLs match `<SITE_URL>/example/*` will not be cached by the PWA
115125

116126
paginate: 10
117127

@@ -157,10 +167,6 @@ defaults:
157167
values:
158168
layout: page
159169
permalink: /:title/
160-
- scope:
161-
path: assets/img/favicons
162-
values:
163-
swcache: true
164170
- scope:
165171
path: assets/js/dist
166172
values:

_data/origin/cors.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ cdns:
88
- url: https://fonts.googleapis.com
99
# jsDelivr CDN
1010
- url: https://cdn.jsdelivr.net
11+
# polyfill.io for math
12+
- url: https://polyfill.io
1113

1214
# fonts
1315

@@ -33,7 +35,7 @@ search:
3335
js: https://cdn.jsdelivr.net/npm/[email protected]/dest/simple-jekyll-search.min.js
3436

3537
mermaid:
36-
js: https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js
38+
js: https://cdn.jsdelivr.net/npm/mermaid@10.8.0/dist/mermaid.min.js
3739

3840
dayjs:
3941
js:

_includes/favicons.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
<link rel="apple-touch-icon" sizes="180x180" href="{{ favicon_path }}/apple-touch-icon.png">
99
<link rel="icon" type="image/png" sizes="32x32" href="{{ favicon_path }}/favicon-32x32.png">
1010
<link rel="icon" type="image/png" sizes="16x16" href="{{ favicon_path }}/favicon-16x16.png">
11-
<link rel="manifest" href="{{ favicon_path }}/site.webmanifest">
11+
{% if site.pwa.enabled %}
12+
<link rel="manifest" href="{{ favicon_path }}/site.webmanifest">
13+
{% endif %}
1214
<link rel="shortcut icon" href="{{ favicon_path }}/favicon.ico">
1315
<meta name="apple-mobile-web-app-title" content="{{ site.title }}">
1416
<meta name="application-name" content="{{ site.title }}">

_includes/footer.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
88
"
99
>
1010
<p>
11-
{{ '©' }}
11+
{{- '©' }}
1212
<time>{{ 'now' | date: '%Y' }}</time>
13-
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
13+
14+
{% if site.social.links %}
15+
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
16+
{% else %}
17+
<em class="fst-normal">{{ site.social.name }}</em>.
18+
{% endif %}
19+
1420
{% if site.data.locales[include.lang].copyright.brief %}
1521
<span
1622
data-bs-toggle="tooltip"

_includes/goatcounter.html

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!-- GoatCounter -->
2+
3+
<script
4+
data-goatcounter="https://{{ site.goatcounter.id }}.goatcounter.com/count"
5+
async
6+
src="https://gc.zgo.at/count.js"
7+
></script>
8+

_includes/head.html

+10-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
{% unless src contains '://' %}
2222
{%- capture img_url -%}
23-
{% include img-url.html src=src img_path=page.img_path %}
23+
{% include img-url.html src=src img_path=page.img_path absolute=true %}
2424
{%- endcapture -%}
2525

2626
{%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
@@ -31,15 +31,20 @@
3131

3232
{% elsif site.social_preview_image %}
3333
{%- capture img_url -%}
34-
{% include img-url.html src=site.social_preview_image %}
34+
{% include img-url.html src=site.social_preview_image absolute=true %}
3535
{%- endcapture -%}
3636

3737
{%- capture og_image -%}
3838
<meta property="og:image" content="{{ img_url }}" />
3939
{%- endcapture -%}
4040

41-
{% assign old_meta_clip = '<meta name="twitter:card"' %}
42-
{% assign new_meta_clip = og_image | append: old_meta_clip %}
41+
{%- capture twitter_image -%}
42+
<meta property="twitter:card" content="summary_large_image" />
43+
<meta property="twitter:image" content="{{ img_url }}" />
44+
{%- endcapture -%}
45+
46+
{% assign old_meta_clip = '<meta name="twitter:card" content="summary" />' %}
47+
{% assign new_meta_clip = og_image | append: twitter_image %}
4348
{% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
4449
{% endif %}
4550

@@ -76,7 +81,7 @@
7681
{% endif %}
7782

7883
<!-- Bootstrap -->
79-
<link rel="stylesheet" href="{{ site.data.origin[type].bootstrap.css | relative_url}}">
84+
<link rel="stylesheet" href="{{ site.data.origin[type].bootstrap.css | relative_url }}">
8085

8186
<!-- Font Awesome -->
8287
<link rel="stylesheet" href="{{ site.data.origin[type].fontawesome.css | relative_url }}">

_includes/img-url.html

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
Generate image final URL based on `site.img_cdn`, `page.img_path`
33

44
Arguments:
5-
src - basic image path, required
6-
img_path - relative path of image, optional
5+
src - required, basic image path
6+
img_path - optional, relative path of image
7+
absolute - optional, boolean, if true, generate absolute URL
78

89
Return:
910
image URL
@@ -14,7 +15,7 @@
1415
{%- if url -%}
1516
{% unless url contains ':' %}
1617
{%- comment -%} CND URL {%- endcomment -%}
17-
{% assign prefix = site.img_cdn | default: '' | relative_url %}
18+
{% assign prefix = site.img_cdn | default: '' %}
1819

1920
{%- comment -%} Add page image path prefix {%- endcomment -%}
2021
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
@@ -26,6 +27,12 @@
2627
| replace: '//', '/'
2728
| replace: ':', ':/'
2829
%}
30+
31+
{% if include.absolute %}
32+
{% assign url = url | absolute_url %}
33+
{% else %}
34+
{% assign url = url | relative_url %}
35+
{% endif %}
2936
{% endunless %}
3037
{%- endif -%}
3138

_includes/js-selector.html

+12-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
<!-- layout specified -->
1313

14+
{% assign js_dist = '/assets/js/dist/' %}
15+
1416
{% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %}
1517
{% assign urls = urls | append: ',' | append: site.data.origin[type]['lazy-polyfill'].js %}
1618

@@ -65,7 +67,7 @@
6567
{% assign js = 'commons' %}
6668
{% endcase %}
6769

68-
{% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %}
70+
{% capture script %}{{ js_dist }}{{ js }}.min.js{% endcapture %}
6971
<script defer src="{{ script | relative_url }}"></script>
7072

7173
{% if page.math %}
@@ -83,7 +85,9 @@
8385
displayMath: [
8486
['$$', '$$'],
8587
['\\[', '\\]']
86-
]
88+
],
89+
/* equation numbering */
90+
tags: 'ams'
8791
}
8892
};
8993
</script>
@@ -94,13 +98,16 @@
9498
{% if jekyll.environment == 'production' %}
9599
<!-- PWA -->
96100
{% if site.pwa.enabled %}
97-
<script defer src="{{ '/app.js' | relative_url }}"></script>
98-
{% else %}
99-
<script defer src="{{ '/unregister.js' | relative_url }}"></script>
101+
<script defer src="{{ 'app.min.js' | prepend: js_dist | relative_url }}"></script>
100102
{% endif %}
101103

102104
<!-- GA -->
103105
{% if site.google_analytics.id != empty and site.google_analytics.id %}
104106
{% include google-analytics.html %}
105107
{% endif %}
108+
109+
<!-- GoatCounter -->
110+
{% if site.goatcounter.id != empty and site.goatcounter.id %}
111+
{% include goatcounter.html %}
112+
{% endif %}
106113
{% endif %}

_includes/topbar.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{% if forloop.first %}
1818
<span>
1919
<a href="{{ '/' | relative_url }}">
20-
{{ site.data.locales[include.lang].tabs.home | capitalize }}
20+
{{- site.data.locales[include.lang].tabs.home | capitalize -}}
2121
</a>
2222
</span>
2323

@@ -30,8 +30,8 @@
3030

3131
{% elsif page.layout == 'category' or page.layout == 'tag' %}
3232
<span>
33-
<a href="{{ item | relative_url }}">
34-
{{ site.data.locales[include.lang].tabs[item] | default: page.title }}
33+
<a href="{{ item | append: '/' | relative_url }}">
34+
{{- site.data.locales[include.lang].tabs[item] | default: page.title -}}
3535
</a>
3636
</span>
3737
{% endif %}

_javascript/modules/components/toc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export function toc() {
2-
if (document.querySelector('main h2')) {
2+
if (document.querySelector('main h2, main h3')) {
33
// see: https://github.com/tscanlin/tocbot#usage
44
tocbot.init({
55
tocSelector: '#toc',

_posts/2019-08-08-text-and-typography.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,14 @@ fi;
134134

135135
The mathematics powered by [**MathJax**](https://www.mathjax.org/):
136136

137-
$$ \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} $$
137+
$$
138+
\begin{equation}
139+
\sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6}
140+
\label{eq:series}
141+
\end{equation}
142+
$$
143+
144+
We can reference the equation as \eqref{eq:series}.
138145

139146
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
140147

0 commit comments

Comments
 (0)