Skip to content

Commit e4751ab

Browse files
committed
Merge branch 'v4' of https://github.com/jackyzha0/quartz into v4
2 parents 295596a + e918f11 commit e4751ab

File tree

9 files changed

+73
-39
lines changed

9 files changed

+73
-39
lines changed

.github/workflows/build-preview.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
name: Build Preview
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515
with:
1616
fetch-depth: 0
1717

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
permissions:
2020
contents: write
2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v5
2323
with:
2424
fetch-depth: 0
2525

@@ -53,7 +53,7 @@ jobs:
5353
permissions:
5454
contents: write
5555
steps:
56-
- uses: actions/checkout@v4
56+
- uses: actions/checkout@v5
5757
with:
5858
fetch-depth: 0
5959
- name: Setup Node

.github/workflows/deploy-preview.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
name: Deploy Preview to Cloudflare Pages
1919
steps:
2020
- name: Download build artifact
21-
uses: actions/download-artifact@v4
21+
uses: actions/download-artifact@v5
2222
id: preview-build-artifact
2323
with:
2424
name: preview-build

.github/workflows/docker-build-push.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ jobs:
2121
echo "OWNER_LOWERCASE=${OWNER,,}" >> ${GITHUB_ENV}
2222
env:
2323
OWNER: "${{ github.repository_owner }}"
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v5
2525
with:
2626
fetch-depth: 1
2727
- name: Inject slug/short variables
28-
uses: rlespinasse/github-slug-action@v5.1.0
28+
uses: rlespinasse/github-slug-action@v5.2.0
2929
- name: Set up QEMU
3030
uses: docker/setup-qemu-action@v3
3131
- name: Set up Docker Buildx

docs/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ This part of the configuration concerns anything that can affect the whole site.
3434
- `{ provider: 'tinylytics', siteId: '<your-site-id>' }`: use [Tinylytics](https://tinylytics.app/);
3535
- `{ provider: 'cabin' }` or `{ provider: 'cabin', host: 'https://cabin.example.com' }` (custom domain): use [Cabin](https://withcabin.com);
3636
- `{provider: 'clarity', projectId: '<your-clarity-id-code' }`: use [Microsoft clarity](https://clarity.microsoft.com/). The project id can be found on top of the overview page.
37+
- `{ provider: 'matomo', siteId: '<your-matomo-id-code', host: 'matomo.example.com' }`: use [Matomo](https://matomo.org/), without protocol.
3738
- `locale`: used for [[i18n]] and date formatting
3839
- `baseUrl`: this is used for sitemaps and RSS feeds that require an absolute URL to know where the canonical 'home' of your site lives. This is normally the deployed URL of your site (e.g. `quartz.jzhao.xyz` for this site). Do not include the protocol (i.e. `https://`) or any leading or trailing slashes.
3940
- This should also include the subpath if you are [[hosting]] on GitHub pages without a custom domain. For example, if my repository is `jackyzha0/quartz`, GitHub pages would deploy to `https://jackyzha0.github.io/quartz` and the `baseUrl` would be `jackyzha0.github.io/quartz`.

package-lock.json

Lines changed: 32 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
"dependencies": {
3838
"@clack/prompts": "^0.11.0",
39-
"@floating-ui/dom": "^1.7.2",
39+
"@floating-ui/dom": "^1.7.3",
4040
"@myriaddreamin/rehype-typst": "^0.6.0",
4141
"@napi-rs/simple-git": "0.1.21",
4242
"@tweenjs/tween.js": "^25.0.0",
@@ -120,6 +120,6 @@
120120
"esbuild": "^0.25.6",
121121
"prettier": "^3.6.2",
122122
"tsx": "^4.20.3",
123-
"typescript": "^5.8.3"
123+
"typescript": "^5.9.2"
124124
}
125125
}

quartz/cfg.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ export type Analytics =
4242
provider: "clarity"
4343
projectId?: string
4444
}
45+
| {
46+
provider: "matomo"
47+
host: string
48+
siteId: string
49+
}
4550

4651
export interface GlobalConfiguration {
4752
pageTitle: string

quartz/plugins/emitters/componentResources.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,33 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso
201201
})(window, document, "clarity", "script", "${cfg.analytics.projectId}");\`
202202
document.head.appendChild(clarityScript)
203203
`)
204+
} else if (cfg.analytics?.provider === "matomo") {
205+
componentResources.afterDOMLoaded.push(`
206+
const matomoScript = document.createElement("script");
207+
matomoScript.innerHTML = \`
208+
let _paq = window._paq = window._paq || [];
209+
210+
// Track SPA navigation
211+
// https://developer.matomo.org/guides/spa-tracking
212+
document.addEventListener("nav", () => {
213+
_paq.push(['setCustomUrl', location.pathname]);
214+
_paq.push(['setDocumentTitle', document.title]);
215+
_paq.push(['trackPageView']);
216+
});
217+
218+
_paq.push(['trackPageView']);
219+
_paq.push(['enableLinkTracking']);
220+
(function() {
221+
const u="//${cfg.analytics.host}/";
222+
_paq.push(['setTrackerUrl', u+'matomo.php']);
223+
_paq.push(['setSiteId', ${cfg.analytics.siteId}]);
224+
const d=document, g=d.createElement('script'), s=d.getElementsByTagName
225+
('script')[0];
226+
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
227+
})();
228+
\`
229+
document.head.appendChild(matomoScript);
230+
`)
204231
}
205232

206233
if (cfg.enableSPA) {

0 commit comments

Comments
 (0)