From 1f032f538b4ce9f477b92be2da68d50606802c6d Mon Sep 17 00:00:00 2001 From: kwyuan <72662648+joeyscave@users.noreply.github.com> Date: Tue, 9 Apr 2024 09:43:09 +0800 Subject: [PATCH 1/7] feat(analytics): PostHog support (#1072) --- docs/configuration.md | 1 + quartz/cfg.ts | 5 +++++ quartz/plugins/emitters/componentResources.ts | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index 64968fb..1408f71 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -29,6 +29,7 @@ This part of the configuration concerns anything that can affect the whole site. - `{ provider: 'plausible' }` (managed) or `{ provider: 'plausible', host: '' }` (self-hosted): use [Plausible](https://plausible.io/); - `{ provider: 'umami', host: '', websiteId: '' }`: use [Umami](https://umami.is/); - `{ provider: 'goatcounter', websiteId: 'my-goatcounter-id' }` (managed) or `{ provider: 'goatcounter', websiteId: 'my-goatcounter-id', host: 'my-goatcounter-domain.com', scriptSrc: 'https://my-url.to/counter.js' }` (self-hosted) use [GoatCounter](https://goatcounter.com) + - `{ provider: 'posthog', apiKey: '', host: '' }`: use [Posthog](https://posthog.com/); - `locale`: used for [[i18n]] and date formatting - `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. - 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`. diff --git a/quartz/cfg.ts b/quartz/cfg.ts index 2e32b1f..09905e9 100644 --- a/quartz/cfg.ts +++ b/quartz/cfg.ts @@ -25,6 +25,11 @@ export type Analytics = host?: string scriptSrc?: string } + | { + provider: "posthog" + apiKey: string + host?: string + } export interface GlobalConfiguration { pageTitle: string diff --git a/quartz/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts index 0bccb60..81d3af2 100644 --- a/quartz/plugins/emitters/componentResources.ts +++ b/quartz/plugins/emitters/componentResources.ts @@ -129,6 +129,13 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso "https://${cfg.analytics.websiteId}.${cfg.analytics.host ?? "goatcounter.com"}/count") document.head.appendChild(goatcounterScript) `) + } else if (cfg.analytics?.provider === "posthog") { + componentResources.afterDOMLoaded.push(` + const posthogScript = document.createElement("script") + posthogScript.innerHTML= \`!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(" "),n=0;n Date: Fri, 12 Apr 2024 02:30:21 -0400 Subject: [PATCH 2/7] chore(deps-dev): bump @types/node from 20.11.29 to 20.12.5 (#1074) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.29 to 20.12.5. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4b86ffb..3ad2886 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,7 +74,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.11.29", + "@types/node": "^20.12.5", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", @@ -1170,9 +1170,9 @@ } }, "node_modules/@types/node": { - "version": "20.11.29", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.29.tgz", - "integrity": "sha512-P99thMkD/1YkCvAtOd6/zGedKNA0p2fj4ZpjCzcNiSCBWgm3cNRTBfa/qjFnsKkkojxu4vVLtWpesnZ9+ap+gA==", + "version": "20.12.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.5.tgz", + "integrity": "sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/package.json b/package.json index a2785b9..e047e1b 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.11.29", + "@types/node": "^20.12.5", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.10", From 4d73b8289d16fde3271e748b84fd7f90a56a8899 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 02:33:05 -0400 Subject: [PATCH 3/7] chore(deps): bump workerpool from 9.1.0 to 9.1.1 (#1073) Bumps [workerpool](https://github.com/josdejong/workerpool) from 9.1.0 to 9.1.1. - [Changelog](https://github.com/josdejong/workerpool/blob/master/HISTORY.md) - [Commits](https://github.com/josdejong/workerpool/compare/v9.1.0...v9.1.1) --- updated-dependencies: - dependency-name: workerpool dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3ad2886..7f424ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,7 +62,7 @@ "unified": "^11.0.4", "unist-util-visit": "^5.0.0", "vfile": "^6.0.1", - "workerpool": "^9.1.0", + "workerpool": "^9.1.1", "ws": "^8.15.1", "yargs": "^17.7.2" }, @@ -6325,9 +6325,9 @@ "integrity": "sha512-Gd9+TUn5nXdwj/hFsPVx5cuHHiF5Bwuc30jZ4+ronF1qHK5O7HD0sgmXWSEgwKquT3ClLoKPVbO6qGwVwLzvAw==" }, "node_modules/workerpool": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.1.0.tgz", - "integrity": "sha512-+wRWfm9yyJghvXLSHMQj3WXDxHbibHAQmRrWbqKBfy0RjftZNeQaW+Std5bSYc83ydkrxoPTPOWVlXUR9RWJdQ==" + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.1.1.tgz", + "integrity": "sha512-EFoFTSEo9m4V4wNrwzVRjxnf/E/oBpOzcI/R5CIugJhl9RsCiq525rszo4AtqcjQQoqFdu2E3H82AnbtpaQHvg==" }, "node_modules/wrap-ansi": { "version": "8.1.0", diff --git a/package.json b/package.json index e047e1b..855ca22 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "unified": "^11.0.4", "unist-util-visit": "^5.0.0", "vfile": "^6.0.1", - "workerpool": "^9.1.0", + "workerpool": "^9.1.1", "ws": "^8.15.1", "yargs": "^17.7.2" }, From 6a019dae13c8800c36c763f31f716f0aeff7972e Mon Sep 17 00:00:00 2001 From: Lucas-BRT <93885104+Lucas-BRT@users.noreply.github.com> Date: Tue, 16 Apr 2024 22:02:59 -0300 Subject: [PATCH 4/7] fix: unnecessery 'm' letter removed in pt-BR (#1100) --- quartz/i18n/locales/pt-BR.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/i18n/locales/pt-BR.ts b/quartz/i18n/locales/pt-BR.ts index b59c7b4..489d642 100644 --- a/quartz/i18n/locales/pt-BR.ts +++ b/quartz/i18n/locales/pt-BR.ts @@ -69,7 +69,7 @@ export default { folderContent: { folder: "Arquivo", itemsUnderFolder: ({ count }) => - count === 1 ? "1 item mneste arquivo." : `${count} items neste arquivo.`, + count === 1 ? "1 item neste arquivo." : `${count} items neste arquivo.`, }, tagContent: { tag: "Tag", From e763e1969e9796d8f55110f32f645f4ff009968a Mon Sep 17 00:00:00 2001 From: iacore <74560659+iacore@users.noreply.github.com> Date: Fri, 19 Apr 2024 20:02:49 +0000 Subject: [PATCH 5/7] Allow pnpm quartz (#1078) Co-authored-by: iacore --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 855ca22..de49b55 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "url": "https://github.com/jackyzha0/quartz.git" }, "scripts": { + "quartz": "./quartz/bootstrap-cli.mjs", "docs": "npx quartz build --serve -d docs", "check": "tsc --noEmit && npx prettier . --check", "format": "npx prettier . --write", From a37c7775e771afff1adf4ebcaf3e04570a683b78 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 27 Apr 2024 21:04:38 -0700 Subject: [PATCH 6/7] chore(deps): bump preact-render-to-string from 6.4.0 to 6.4.2 (#1094) Bumps [preact-render-to-string](https://github.com/preactjs/preact-render-to-string) from 6.4.0 to 6.4.2. - [Release notes](https://github.com/preactjs/preact-render-to-string/releases) - [Changelog](https://github.com/preactjs/preact-render-to-string/blob/main/CHANGELOG.md) - [Commits](https://github.com/preactjs/preact-render-to-string/compare/6.4.0...v6.4.2) --- updated-dependencies: - dependency-name: preact-render-to-string dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7f424ab..b8c9e16 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "mdast-util-to-string": "^4.0.0", "micromorph": "^0.4.5", "preact": "^10.20.1", - "preact-render-to-string": "^6.4.0", + "preact-render-to-string": "^6.4.2", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", "reading-time": "^1.5.0", @@ -4705,9 +4705,9 @@ } }, "node_modules/preact-render-to-string": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.4.0.tgz", - "integrity": "sha512-pzDwezZaLbK371OiJjXDsZJwVOALzFX5M1wEh2Kr0pEApq5AV6bRH/DFbA/zNA7Lck/duyREPQLLvzu2G6hEQQ==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.4.2.tgz", + "integrity": "sha512-Sio5SvlyZSAXHuvnMgYzVQd67lNIuQe4uSjJ+2gfpJNC6L8zoHQR5xV7B/EjIqrAYWVyJ2eACkTCxVrIzZi6Vw==", "dependencies": { "pretty-format": "^3.8.0" }, diff --git a/package.json b/package.json index de49b55..7cf2798 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "mdast-util-to-string": "^4.0.0", "micromorph": "^0.4.5", "preact": "^10.20.1", - "preact-render-to-string": "^6.4.0", + "preact-render-to-string": "^6.4.2", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", "reading-time": "^1.5.0", From aee9145691a0f372419fa840168858229adaaa37 Mon Sep 17 00:00:00 2001 From: Emmanuel Ferdman Date: Sun, 28 Apr 2024 07:07:26 +0300 Subject: [PATCH 7/7] fix: update link to hosting page (#1054) * fix: update link to hosting page * chore: update correct path with using alias --------- Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- docs/plugins/CNAME.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins/CNAME.md b/docs/plugins/CNAME.md index b81faee..bc12b5a 100644 --- a/docs/plugins/CNAME.md +++ b/docs/plugins/CNAME.md @@ -8,7 +8,7 @@ This plugin emits a `CNAME` record that points your subdomain to the default dom If you want to use a custom domain name like `quartz.example.com` for the site, then this is needed. -See [[Hosting]] for more information. +See [[hosting|Hosting]] for more information. > [!note] > For information on how to add, remove or configure plugins, see the [[configuration#Plugins|Configuration]] page.