Skip to content

Commit 552cf1f

Browse files
authored
Drop <lastmod> from the preview sitemap (#2885)
1 parent 9e7c069 commit 552cf1f

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎.changeset/sitemap-drop-lastmod.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@tabler/preview": patch
3+
---
4+
5+
Removed the `<lastmod>` element from `sitemap.xml`, which carried the build time instead of a content date.

‎preview/pages/sitemap.xml.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ const escapeXml = (value: string) => value.replace(/&/g, '&amp;').replace(/</g,
2525
export const GET: APIRoute = () => {
2626
const environment = process.env.NODE_ENV || 'production'
2727
const baseUrl = environment !== 'development' ? site.previewUrl : ''
28-
// ISO 8601 UTC timestamp (+00:00 suffix)
29-
const lastModified = new Date().toISOString().replace(/\.\d{3}Z$/, '+00:00')
28+
// No <lastmod>: it is optional, and stamping every url with the build time
29+
// said nothing about the pages while making the file differ on every build.
3030
const entries = urls
3131
.map(
3232
(url) => `<url>
3333
<loc>${escapeXml(`${baseUrl}${url}`)}</loc>
34-
<lastmod>${lastModified}</lastmod>
3534
</url>`,
3635
)
3736
.join('\n')

0 commit comments

Comments
 (0)