@xingwangzhe/stalux 1.20.0 → 1.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ export default defineConfig({
|
|
|
54
54
|
Create `src/content.config.ts`:
|
|
55
55
|
|
|
56
56
|
```ts
|
|
57
|
-
import { defineCollections } from "@xingwangzhe/stalux/schemas";
|
|
57
|
+
import { defineCollections } from "@xingwangzhe/stalux/schemas/collections";
|
|
58
58
|
export const collections = defineCollections({ contentDir: "stalux" });
|
|
59
59
|
```
|
|
60
60
|
|
|
@@ -144,6 +144,21 @@ stalux/
|
|
|
144
144
|
└── words/ # Quotes / short notes
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
+
### Analytics configuration
|
|
148
|
+
|
|
149
|
+
Analytics are configured in `stalux/config/head.yml`, so no template changes are needed:
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
id: head
|
|
153
|
+
bingClarityId: "YOUR_CLARITY_PROJECT_ID"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`bingClarityId` is the historical Stalux field name for a Microsoft Clarity Project ID. Get the ID from the Clarity project under **Settings → Setup → Get tracking code**. Stalux injects the asynchronous tracking code into `<head>` and keeps one loader during Astro View Transitions. Do not install the same project again through `anyhead`, a tag manager, or another plugin.
|
|
157
|
+
|
|
158
|
+
The Project ID is a public browser identifier. Never put a Clarity Data Export API token in this YAML or in client-side code. If the site uses a strict CSP, consent banner, or CMP, configure those host-site policies and signals separately; this theme does not make legal compliance decisions for the site.
|
|
159
|
+
|
|
160
|
+
After deployment, verify the script URL contains the exact Project ID and that the browser sends requests to `https://www.clarity.ms/collect`.
|
|
161
|
+
|
|
147
162
|
---
|
|
148
163
|
|
|
149
164
|
## 🛠️ Development Commands
|
package/package.json
CHANGED
package/scripts/cli.mjs
CHANGED
|
@@ -60,9 +60,10 @@ items:
|
|
|
60
60
|
`,
|
|
61
61
|
"head.yml": `id: head
|
|
62
62
|
# googleAnalyticsId: "G-XXXXXXXXXX"
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
63
|
+
# bingClarityId: "xxxxxxxxxx"
|
|
64
|
+
# umami:
|
|
65
|
+
# id: ""
|
|
66
|
+
# url: ""
|
|
66
67
|
# anyhead: ""
|
|
67
68
|
`,
|
|
68
69
|
"footer.yml": `id: footer
|
|
@@ -91,7 +92,7 @@ badges:
|
|
|
91
92
|
custom: |
|
|
92
93
|
<div id="custom-footer-hook"></div>
|
|
93
94
|
`,
|
|
94
|
-
"media-links.yml": `id:
|
|
95
|
+
"media-links.yml": `id: media-links
|
|
95
96
|
items:
|
|
96
97
|
- icon: "github"
|
|
97
98
|
link: "https://github.com/yourname"
|
|
@@ -102,24 +103,18 @@ description: "Friends & Resources"
|
|
|
102
103
|
sites:
|
|
103
104
|
- name: "Astro"
|
|
104
105
|
description: "The web framework for content-driven websites"
|
|
105
|
-
|
|
106
|
+
link: "https://astro.build"
|
|
106
107
|
icon: "https://astro.build/favicon.svg"
|
|
107
108
|
`,
|
|
108
109
|
"comment.yml": `id: comment
|
|
109
110
|
enabled: false
|
|
110
|
-
waline:
|
|
111
|
-
serverURL: ""
|
|
112
|
-
lang: ""
|
|
113
|
-
locale: ""
|
|
114
|
-
pageSize: 10
|
|
115
|
-
recaptchaV3Key: ""
|
|
116
111
|
`,
|
|
117
112
|
"promote.yml": `id: promote
|
|
118
113
|
export_md: false
|
|
119
114
|
# llm_promote: |
|
|
120
115
|
`,
|
|
121
116
|
"ai-discovery.yml": `id: ai-discovery
|
|
122
|
-
conformance: "
|
|
117
|
+
conformance: "disabled"
|
|
123
118
|
`,
|
|
124
119
|
"typetexts.yml": `id: typetexts
|
|
125
120
|
items:
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { getCollection } from "astro:content";
|
|
3
|
-
import {
|
|
3
|
+
import { getHeadData } from "@utils/config-utils";
|
|
4
4
|
const configEntries = await getCollection("config");
|
|
5
5
|
const headConfig = getHeadData(configEntries);
|
|
6
|
-
const id = headConfig?.bingClarityId
|
|
6
|
+
const id = headConfig?.bingClarityId;
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
<script is:inline data-astro-rerun define:vars={{ id }}>
|
|
10
10
|
// 防止重复初始化
|
|
11
|
-
if (!window.clarity) {
|
|
11
|
+
if (id && !document.getElementById("stalux-clarity-script") && !window.clarity) {
|
|
12
12
|
(function (c, l, a, r, i, t, y) {
|
|
13
13
|
c[a] =
|
|
14
14
|
c[a] ||
|
|
@@ -16,6 +16,7 @@ const id = headConfig?.bingClarityId | undefined;
|
|
|
16
16
|
(c[a].q = c[a].q || []).push(arguments);
|
|
17
17
|
};
|
|
18
18
|
t = l.createElement(r);
|
|
19
|
+
t.id = "stalux-clarity-script";
|
|
19
20
|
t.async = 1;
|
|
20
21
|
t.src = "https://www.clarity.ms/tag/" + i;
|
|
21
22
|
y = l.getElementsByTagName(r)[0];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { getCollection } from "astro:content";
|
|
3
|
-
import {
|
|
3
|
+
import { getHeadData } from "@utils/config-utils";
|
|
4
4
|
const configEntries = await getCollection("config");
|
|
5
5
|
const headConfig = getHeadData(configEntries);
|
|
6
|
-
const gaID = headConfig?.googleAnalyticsId
|
|
6
|
+
const gaID = headConfig?.googleAnalyticsId;
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
<script
|