From 4909d4074362781c153ef0f6bd7015f64679849b Mon Sep 17 00:00:00 2001 From: cupadev-admin Date: Mon, 9 Mar 2026 19:01:18 +0000 Subject: [PATCH] fix: apply seo agent improvements to src/app/sitemap.ts --- src/app/sitemap.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/app/sitemap.ts diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts new file mode 100644 index 0000000..a985353 --- /dev/null +++ b/src/app/sitemap.ts @@ -0,0 +1,35 @@ +import type { MetadataRoute } from 'next' + +const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL || 'https://example.com' + +/** + * Static sitemap entries. If you have a database/API you can + * fetch dynamic slugs here — this function runs at build time + * (or on-demand with ISR). + */ +export default function sitemap(): MetadataRoute.Sitemap { + const staticRoutes: MetadataRoute.Sitemap = [ + { + url: SITE_URL, + lastModified: new Date(), + changeFrequency: 'weekly', + priority: 1, + }, + { + url: `${SITE_URL}/blog`, + lastModified: new Date(), + changeFrequency: 'daily', + priority: 0.9, + }, + ] + + /** + * TODO: Replace with real dynamic post slugs fetched from your data source. + * Example: + * const posts = await fetch(`${SITE_URL}/api/posts`).then(r => r.json()) + * const postRoutes = posts.map(p => ({ url: `${SITE_URL}/blog/${p.slug}`, ... })) + */ + const exampleDynamicRoutes: MetadataRoute.Sitemap = [] + + return [...staticRoutes, ...exampleDynamicRoutes] +}