Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 994b2ac

Browse files
committed
feat(blog): add sitemap.ts with blog and blog post URLs
- Create sitemap.ts with MetadataRoute.Sitemap for Next.js - Include all static pages with priorities and change frequencies - Include /blog index page (priority 0.8, daily updates) - Dynamically include all published blog post URLs (/blog/[slug]) - Blog posts use publish_date as lastModified The sitemap is referenced by robots.ts at /sitemap.xml MKT-71
1 parent fe1bfc1 commit 994b2ac

1 file changed

Lines changed: 120 additions & 0 deletions

File tree

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import type { MetadataRoute } from "next"
2+
import { SEO } from "@/lib/seo"
3+
import { getAllBlogPosts } from "@/lib/blog"
4+
5+
/**
6+
* Generate sitemap for the website
7+
* Includes all static pages and dynamically generated blog post URLs
8+
*
9+
* @see https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap
10+
*/
11+
export default function sitemap(): MetadataRoute.Sitemap {
12+
const baseUrl = SEO.url
13+
14+
// Static pages with their last modified dates and priorities
15+
const staticPages: MetadataRoute.Sitemap = [
16+
{
17+
url: baseUrl,
18+
lastModified: new Date(),
19+
changeFrequency: "daily",
20+
priority: 1,
21+
},
22+
{
23+
url: `${baseUrl}/pricing`,
24+
lastModified: new Date(),
25+
changeFrequency: "weekly",
26+
priority: 0.9,
27+
},
28+
{
29+
url: `${baseUrl}/extension`,
30+
lastModified: new Date(),
31+
changeFrequency: "weekly",
32+
priority: 0.8,
33+
},
34+
{
35+
url: `${baseUrl}/cloud`,
36+
lastModified: new Date(),
37+
changeFrequency: "weekly",
38+
priority: 0.8,
39+
},
40+
{
41+
url: `${baseUrl}/slack`,
42+
lastModified: new Date(),
43+
changeFrequency: "weekly",
44+
priority: 0.7,
45+
},
46+
{
47+
url: `${baseUrl}/provider`,
48+
lastModified: new Date(),
49+
changeFrequency: "weekly",
50+
priority: 0.7,
51+
},
52+
{
53+
url: `${baseUrl}/enterprise`,
54+
lastModified: new Date(),
55+
changeFrequency: "monthly",
56+
priority: 0.7,
57+
},
58+
{
59+
url: `${baseUrl}/evals`,
60+
lastModified: new Date(),
61+
changeFrequency: "weekly",
62+
priority: 0.6,
63+
},
64+
{
65+
url: `${baseUrl}/reviewer`,
66+
lastModified: new Date(),
67+
changeFrequency: "weekly",
68+
priority: 0.6,
69+
},
70+
{
71+
url: `${baseUrl}/pr-fixer`,
72+
lastModified: new Date(),
73+
changeFrequency: "weekly",
74+
priority: 0.6,
75+
},
76+
// Blog index page
77+
{
78+
url: `${baseUrl}/blog`,
79+
lastModified: new Date(),
80+
changeFrequency: "daily",
81+
priority: 0.8,
82+
},
83+
// Legal pages
84+
{
85+
url: `${baseUrl}/terms`,
86+
lastModified: new Date(),
87+
changeFrequency: "monthly",
88+
priority: 0.3,
89+
},
90+
{
91+
url: `${baseUrl}/privacy`,
92+
lastModified: new Date(),
93+
changeFrequency: "monthly",
94+
priority: 0.3,
95+
},
96+
{
97+
url: `${baseUrl}/legal/cookies`,
98+
lastModified: new Date(),
99+
changeFrequency: "monthly",
100+
priority: 0.2,
101+
},
102+
{
103+
url: `${baseUrl}/legal/subprocessors`,
104+
lastModified: new Date(),
105+
changeFrequency: "monthly",
106+
priority: 0.2,
107+
},
108+
]
109+
110+
// Get all published blog posts and generate URLs
111+
const blogPosts = getAllBlogPosts()
112+
const blogPages: MetadataRoute.Sitemap = blogPosts.map((post) => ({
113+
url: `${baseUrl}/blog/${post.slug}`,
114+
lastModified: new Date(post.publish_date),
115+
changeFrequency: "monthly" as const,
116+
priority: 0.7,
117+
}))
118+
119+
return [...staticPages, ...blogPages]
120+
}

0 commit comments

Comments
 (0)