Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/app/sitemap.test.ts
Original file line number Diff line number Diff line change
@@ -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);
});
});
4 changes: 3 additions & 1 deletion src/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -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,
}));
Expand Down