fix: apply seo agent improvements to src/app/sitemap.ts
This commit is contained in:
parent
8e1dd3df62
commit
4909d40743
|
|
@ -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]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue