mirror of
https://github.com/tabler/tabler.git
synced 2026-10-12 05:06:55 +04:00
Drop <lastmod> from the preview sitemap (#2885)
This commit is contained in:
1 parent
9e7c06954d
commit
552cf1fad8
2 files changed
+7
-3
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@tabler/preview": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Removed the `<lastmod>` element from `sitemap.xml`, which carried the build time instead of a content date.
|
||||||
@@ -25,13 +25,12 @@ const escapeXml = (value: string) => value.replace(/&/g, '&').replace(/</g,
|
|||||||
export const GET: APIRoute = () => {
|
export const GET: APIRoute = () => {
|
||||||
const environment = process.env.NODE_ENV || 'production'
|
const environment = process.env.NODE_ENV || 'production'
|
||||||
const baseUrl = environment !== 'development' ? site.previewUrl : ''
|
const baseUrl = environment !== 'development' ? site.previewUrl : ''
|
||||||
// ISO 8601 UTC timestamp (+00:00 suffix)
|
// No <lastmod>: it is optional, and stamping every url with the build time
|
||||||
const lastModified = new Date().toISOString().replace(/\.\d{3}Z$/, '+00:00')
|
// said nothing about the pages while making the file differ on every build.
|
||||||
const entries = urls
|
const entries = urls
|
||||||
.map(
|
.map(
|
||||||
(url) => `<url>
|
(url) => `<url>
|
||||||
<loc>${escapeXml(`${baseUrl}${url}`)}</loc>
|
<loc>${escapeXml(`${baseUrl}${url}`)}</loc>
|
||||||
<lastmod>${lastModified}</lastmod>
|
|
||||||
</url>`,
|
</url>`,
|
||||||
)
|
)
|
||||||
.join('\n')
|
.join('\n')
|
||||||
|
|||||||
Reference in new issue
Block a user