Skip to content

Commit 891d8c2

Browse files
committed
fix: sitemap-0 format
1 parent 5f85943 commit 891d8c2

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

next-sitemap.config.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ module.exports = {
44
generateRobotsTxt: true,
55
sitemapSize: 7000,
66
outDir: './out',
7+
// Enable pretty XML output
8+
prettyXml: true,
79

810
// Additional paths to include in the sitemap
911
additionalPaths: async (config) => {
@@ -13,36 +15,43 @@ module.exports = {
1315
// Only include FAQ paths if FAQ feature is enabled
1416
const faqEnabled = process.env.NEXT_PUBLIC_FAQ === 'true';
1517

18+
// Helper function to format date properly (remove milliseconds)
19+
const formatDate = (date) => {
20+
return date.toISOString().replace(/\.\d{3}Z$/, 'Z');
21+
};
22+
23+
const now = formatDate(new Date());
24+
1625
// Generate paths for different locales
1726
for (const locale of locales) {
1827
// Homepage with locale
1928
paths.push({
2029
loc: `/${locale}`,
21-
lastMod: new Date().toISOString(),
30+
lastMod: now,
2231
changefreq: 'daily',
2332
priority: 1.0
2433
});
2534

2635
// Enterprise page
2736
paths.push({
2837
loc: `/${locale}/enterprise`,
29-
lastMod: new Date().toISOString(),
38+
lastMod: now,
3039
changefreq: 'weekly',
3140
priority: 0.8
3241
});
3342

3443
// Price page
3544
paths.push({
3645
loc: `/${locale}/price`,
37-
lastMod: new Date().toISOString(),
46+
lastMod: now,
3847
changefreq: 'weekly',
3948
priority: 0.8
4049
});
4150

4251
// FAQ page
4352
paths.push({
4453
loc: `/${locale}/faq`,
45-
lastMod: new Date().toISOString(),
54+
lastMod: now,
4655
changefreq: 'daily',
4756
priority: 0.9
4857
});
@@ -59,7 +68,7 @@ module.exports = {
5968
faqIds.forEach((id) => {
6069
paths.push({
6170
loc: `/${locale}/faq/${id}`,
62-
lastMod: new Date().toISOString(),
71+
lastMod: now,
6372
changefreq: 'weekly',
6473
priority: 0.7
6574
});
@@ -74,7 +83,7 @@ module.exports = {
7483
// Root homepage
7584
paths.push({
7685
loc: '/',
77-
lastMod: new Date().toISOString(),
86+
lastMod: now,
7887
changefreq: 'daily',
7988
priority: 1.0
8089
});

0 commit comments

Comments
 (0)