@xingwangzhe/stalux 1.14.0 → 1.15.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xingwangzhe/stalux",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "A powerful, modern Astro blog theme — use as template or install as plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@types/node": "^26.1.2",
|
|
101
|
+
"astro": "^7.2.0",
|
|
101
102
|
"knip": "^6.31.0",
|
|
102
103
|
"license-checker-rseidelsohn": "5.0.1",
|
|
103
104
|
"oxfmt": "^0.62.0",
|
|
@@ -105,6 +106,6 @@
|
|
|
105
106
|
"typescript": "^7.0.2"
|
|
106
107
|
},
|
|
107
108
|
"peerDependencies": {
|
|
108
|
-
"astro": "
|
|
109
|
+
"astro": "7.2.0"
|
|
109
110
|
}
|
|
110
111
|
}
|
|
@@ -35,8 +35,16 @@ export async function getStaticPaths() {
|
|
|
35
35
|
// sorted 按日期降序:sorted[i-1] 比当前新(next),sorted[i+1] 比当前旧(prev)
|
|
36
36
|
const nextPost = i > 0 ? sorted[i - 1] : undefined;
|
|
37
37
|
const prevPost = i < sorted.length - 1 ? sorted[i + 1] : undefined;
|
|
38
|
+
// 增量构建 cacheKey:含自身与 prev/next 的更新时间,
|
|
39
|
+
// 任一邻居变化(文章新增/编辑导致前后链接变化)时本页也会失效重渲染
|
|
40
|
+
const cacheKey = [
|
|
41
|
+
post.data.updated ?? post.data.date,
|
|
42
|
+
prevPost ? (prevPost.data.updated ?? prevPost.data.date) : "",
|
|
43
|
+
nextPost ? (nextPost.data.updated ?? nextPost.data.date) : "",
|
|
44
|
+
].join("|");
|
|
38
45
|
return {
|
|
39
46
|
params: { post: post.data.abbrlink },
|
|
47
|
+
cacheKey,
|
|
40
48
|
props: {
|
|
41
49
|
post,
|
|
42
50
|
prev: prevPost
|
|
@@ -78,6 +78,7 @@ export const getStaticPaths = (async () => {
|
|
|
78
78
|
const posts = await getCollection("posts", ({ data }) => !data.draft);
|
|
79
79
|
return posts.map((post) => ({
|
|
80
80
|
params: { post: String(post.data.abbrlink) },
|
|
81
|
+
cacheKey: post.data.updated ?? post.data.date,
|
|
81
82
|
props: { post },
|
|
82
83
|
}));
|
|
83
84
|
}) satisfies GetStaticPaths;
|
package/src/utils/taxonomy.ts
CHANGED
|
@@ -32,13 +32,22 @@ export async function buildTaxonomyStaticPaths(key: TaxonomyKey): Promise<GetSta
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
return [...map].map(([name, entry]) =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
return [...map].map(([name, entry]) => {
|
|
36
|
+
// 增量构建 cacheKey:该分类/标签下全部文章更新时间拼接,
|
|
37
|
+
// 任一文章新增/编辑/变更分类都会改变列表输出并失效本页
|
|
38
|
+
const cacheKey = entry.posts
|
|
39
|
+
.map((p) => p.data.updated ?? p.data.date)
|
|
40
|
+
.sort()
|
|
41
|
+
.join("|");
|
|
42
|
+
return {
|
|
43
|
+
params: { [paramName]: name },
|
|
44
|
+
cacheKey,
|
|
45
|
+
props: {
|
|
46
|
+
[paramName]: name,
|
|
47
|
+
count: entry.posts.length,
|
|
48
|
+
posts: entry.posts,
|
|
49
|
+
lastUpdateDate: entry.latestTime,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
});
|
|
44
53
|
}
|