Drop <lastmod> from the preview sitemap (#2885)

This commit is contained in:
Paweł Kuna authored and GitHub committed 2026-08-16 22:50:30 +02:00
1 parent 9e7c06954d
commit 552cf1fad8
2 files changed
+7 -3

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@tabler/preview": patch
---
Removed the `<lastmod>` element from `sitemap.xml`, which carried the build time instead of a content date.
+2 -3
View File
@@ -25,13 +25,12 @@ const escapeXml = (value: string) => value.replace(/&/g, '&amp;').replace(/</g,
export const GET: APIRoute = () => {
const environment = process.env.NODE_ENV || 'production'
const baseUrl = environment !== 'development' ? site.previewUrl : ''
// ISO 8601 UTC timestamp (+00:00 suffix)
const lastModified = new Date().toISOString().replace(/\.\d{3}Z$/, '+00:00')
// No <lastmod>: it is optional, and stamping every url with the build time
// said nothing about the pages while making the file differ on every build.
const entries = urls
.map(
(url) => `<url>
<loc>${escapeXml(`${baseUrl}${url}`)}</loc>
<lastmod>${lastModified}</lastmod>
</url>`,
)
.join('\n')