diff --git a/src/app/sitemap.test.ts b/src/app/sitemap.test.ts new file mode 100644 index 0000000..61007a2 --- /dev/null +++ b/src/app/sitemap.test.ts @@ -0,0 +1,12 @@ +import { describe, expect, it } from 'vitest'; +import sitemap from './sitemap'; + +describe('sitemap metadata', () => { + it('uses a stable content date instead of the current request time', () => { + const first = sitemap(); + const second = sitemap(); + + expect(first).toEqual(second); + expect(first.every((entry) => entry.lastModified === '2026-08-20')).toBe(true); + }); +}); diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts index 595689f..0578626 100644 --- a/src/app/sitemap.ts +++ b/src/app/sitemap.ts @@ -1,13 +1,15 @@ import type { MetadataRoute } from 'next'; const BASE_URL = process.env.NEXT_PUBLIC_APP_URL ?? 'http://localhost:3001'; +// Keep this stable between requests; update it when public page content changes. +const LAST_MODIFIED = '2026-08-20'; export default function sitemap(): MetadataRoute.Sitemap { const routes = ['', '/marketplace', '/login', '/register']; return routes.map((route) => ({ url: `${BASE_URL}${route}`, - lastModified: new Date(), + lastModified: LAST_MODIFIED, changeFrequency: route === '' ? 'weekly' : 'monthly', priority: route === '' ? 1 : 0.6, }));