Skip to content

Commit e809779

Browse files
tianzhouclaude
andcommitted
chore: add sitemap.xml generation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 53a0929 commit e809779

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

website/src/app/sitemap.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { MetadataRoute } from 'next'
2+
import { getPosts } from '@/lib/blog'
3+
4+
const BASE_URL = 'https://pgconsole.dev'
5+
6+
export default function sitemap(): MetadataRoute.Sitemap {
7+
const posts = getPosts()
8+
9+
return [
10+
{ url: BASE_URL, lastModified: new Date() },
11+
{ url: `${BASE_URL}/pricing`, lastModified: new Date() },
12+
{ url: `${BASE_URL}/blog`, lastModified: posts[0]?.date ?? new Date() },
13+
...posts.map((post) => ({
14+
url: `${BASE_URL}/blog/${post.slug}`,
15+
lastModified: post.date,
16+
})),
17+
]
18+
}

0 commit comments

Comments
 (0)