Skip to content

Commit acc45a1

Browse files
committed
docs: try to resolve vercel build issue for sitemap
1 parent 7949a21 commit acc45a1

File tree

4 files changed

+33
-16
lines changed

4 files changed

+33
-16
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
"typescript": "5.7.2"
7070
},
7171
"patchedDependencies": {
72-
72+
73+
"@docusaurus/plugin-sitemap": "patches/@docusaurus__plugin-sitemap.patch"
7374
}
7475
}
7576
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/lib/createSitemapItem.js b/lib/createSitemapItem.js
2+
index af7f01f633c98b4daee3ddb947056679afd4395c..b1a73130e43fea772019c5966de6114be70ca931 100644
3+
--- a/lib/createSitemapItem.js
4+
+++ b/lib/createSitemapItem.js
5+
@@ -10,6 +10,8 @@ exports.createSitemapItem = createSitemapItem;
6+
const utils_common_1 = require("@docusaurus/utils-common");
7+
const utils_1 = require("@docusaurus/utils");
8+
async function getRouteLastUpdatedAt(route) {
9+
+ return null;
10+
+
11+
if (route.metadata?.lastUpdatedAt) {
12+
return route.metadata?.lastUpdatedAt;
13+
}

pnpm-lock.yaml

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

website/docusaurus.config.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,18 @@ const config: Config = {
5959
],
6060
},
6161
// need .git file, not easy build in vercel with cli, ignore now
62-
// sitemap: {
63-
// lastmod: 'date',
64-
// changefreq: 'weekly',
65-
// priority: 0.5,
66-
// ignorePatterns: ['/tags/**'],
67-
// filename: 'sitemap.xml',
68-
// createSitemapItems: async (params) => {
69-
// const { defaultCreateSitemapItems, ...rest } = params;
70-
// const items = await defaultCreateSitemapItems(rest);
71-
// return items.filter((item) => !item.url.includes('/page/'));
72-
// },
73-
// },
62+
sitemap: {
63+
lastmod: 'date',
64+
changefreq: 'weekly',
65+
priority: 0.5,
66+
ignorePatterns: ['/tags/**'],
67+
filename: 'sitemap.xml',
68+
createSitemapItems: async (params) => {
69+
const { defaultCreateSitemapItems, ...rest } = params;
70+
const items = await defaultCreateSitemapItems(rest);
71+
return items.filter((item) => !item.url.includes('/page/'));
72+
},
73+
},
7474
},
7575
],
7676
],

0 commit comments

Comments
 (0)