Skip to content

Commit 3ddd542

Browse files
authored
Merge pull request #286 from HarperDB/sitemap
+sitemap
2 parents cbc9003 + 14e5806 commit 3ddd542

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docusaurus.config.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,33 @@ const config: Config = {
150150
createRedirects: (existingPath: string) => createRedirectsBase(existingPath, routeBasePath),
151151
},
152152
],
153+
154+
// Sitemap
155+
[
156+
'@docusaurus/plugin-sitemap',
157+
{
158+
createSitemapItems: async (params: any) => {
159+
const { defaultCreateSitemapItems, ...rest } = params;
160+
const items = await defaultCreateSitemapItems(rest);
161+
return items.map((item: any) => {
162+
// Versioned docs (e.g., /docs/4.5/, /docs/4.4/) - rarely change. could switch to monthly as the dust settles.
163+
if (/\/docs\/\d+\.\d+\//.test(item.url)) {
164+
return { ...item, changefreq: 'weekly' };
165+
}
166+
// Current/latest docs at /docs/ - most frequently updated
167+
if (item.url.includes('/docs/')) {
168+
return { ...item, changefreq: 'daily' };
169+
}
170+
// Release notes - fairly frequent updates
171+
if (item.url.includes('/release-notes/')) {
172+
return { ...item, changefreq: 'weekly' };
173+
}
174+
// Default for everything else
175+
return { ...item, changefreq: 'weekly' };
176+
});
177+
},
178+
},
179+
],
153180
],
154181

155182
themes: [

0 commit comments

Comments
 (0)