mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-20 11:24:05 -06:00
Merge branch 'jackyzha0:v4' into v4
This commit is contained in:
commit
aadc3f4b7f
2
.github/workflows/docker-build-push.yaml
vendored
2
.github/workflows/docker-build-push.yaml
vendored
@ -37,7 +37,7 @@ jobs:
|
|||||||
network=host
|
network=host
|
||||||
- name: Install cosign
|
- name: Install cosign
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: sigstore/cosign-installer@v3.8.2
|
uses: sigstore/cosign-installer@v3.9.1
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
|
|||||||
@ -226,9 +226,11 @@ Then, you can use it like any other component in `quartz.layout.ts` via `Compone
|
|||||||
As Quartz components are just functions that return React components, you can compositionally use them in other Quartz components.
|
As Quartz components are just functions that return React components, you can compositionally use them in other Quartz components.
|
||||||
|
|
||||||
```tsx title="quartz/components/AnotherComponent.tsx"
|
```tsx title="quartz/components/AnotherComponent.tsx"
|
||||||
import YourComponent from "./YourComponent"
|
import YourComponentConstructor from "./YourComponent"
|
||||||
|
|
||||||
export default (() => {
|
export default (() => {
|
||||||
|
const YourComponent = YourComponentConstructor()
|
||||||
|
|
||||||
function AnotherComponent(props: QuartzComponentProps) {
|
function AnotherComponent(props: QuartzComponentProps) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@ -135,15 +135,19 @@ function addGlobalPageResources(ctx: BuildCtx, componentResources: ComponentReso
|
|||||||
`)
|
`)
|
||||||
} else if (cfg.analytics?.provider === "goatcounter") {
|
} else if (cfg.analytics?.provider === "goatcounter") {
|
||||||
componentResources.afterDOMLoaded.push(`
|
componentResources.afterDOMLoaded.push(`
|
||||||
|
const goatcounterScriptPre = document.createElement('script');
|
||||||
|
goatcounterScriptPre.textContent = \`
|
||||||
|
window.goatcounter = { no_onload: true };
|
||||||
|
\`;
|
||||||
|
document.head.appendChild(goatcounterScriptPre);
|
||||||
|
|
||||||
|
const endpoint = "https://${cfg.analytics.websiteId}.${cfg.analytics.host ?? "goatcounter.com"}/count";
|
||||||
const goatcounterScript = document.createElement('script');
|
const goatcounterScript = document.createElement('script');
|
||||||
goatcounterScript.src = "${cfg.analytics.scriptSrc ?? "https://gc.zgo.at/count.js"}";
|
goatcounterScript.src = "${cfg.analytics.scriptSrc ?? "https://gc.zgo.at/count.js"}";
|
||||||
goatcounterScript.defer = true;
|
goatcounterScript.defer = true;
|
||||||
goatcounterScript.setAttribute(
|
goatcounterScript.setAttribute('data-goatcounter', endpoint);
|
||||||
'data-goatcounter',
|
|
||||||
"https://${cfg.analytics.websiteId}.${cfg.analytics.host ?? "goatcounter.com"}/count"
|
|
||||||
);
|
|
||||||
goatcounterScript.onload = () => {
|
goatcounterScript.onload = () => {
|
||||||
window.goatcounter = { no_onload: true };
|
window.goatcounter.endpoint = endpoint;
|
||||||
goatcounter.count({ path: location.pathname });
|
goatcounter.count({ path: location.pathname });
|
||||||
document.addEventListener('nav', () => {
|
document.addEventListener('nav', () => {
|
||||||
goatcounter.count({ path: location.pathname });
|
goatcounter.count({ path: location.pathname });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user