Openstatus
www.openstatus.dev
1import {
2 getBlogPosts,
3 getChangelogPosts,
4 getComparePages,
5 getGuides,
6 getHomePage,
7 getProductPages,
8 getToolsPages,
9 getUnrelatedPages,
10} from "@/content/utils";
11import type { MetadataRoute } from "next";
12
13const allPosts = getBlogPosts();
14const allChangelogs = getChangelogPosts();
15const allComparisons = getComparePages();
16const allUnrelated = getUnrelatedPages().filter(
17 (page) => page.slug !== "not-found",
18);
19const allProducts = getProductPages();
20const allPlaygrounds = getToolsPages().filter(
21 (tool) => tool.slug !== "checker-slug",
22);
23const allGuides = getGuides();
24
25export default function sitemap(): MetadataRoute.Sitemap {
26 const blogs = allPosts.map((post) => ({
27 url: `https://www.openstatus.dev/blog/${post.slug}`,
28 lastModified: post.metadata.publishedAt, // date format should be YYYY-MM-DD
29 changeFrequency: "monthly" as const,
30 priority: 0.7,
31 }));
32
33 const changelogs = allChangelogs.map((post) => ({
34 url: `https://www.openstatus.dev/changelog/${post.slug}`,
35 lastModified: post.metadata.publishedAt, // date format should be YYYY-MM-DD
36 changeFrequency: "weekly" as const,
37 priority: 0.6,
38 }));
39
40 const comparisons = allComparisons.map((comparison) => ({
41 url: `https://www.openstatus.dev/compare/${comparison.slug}`,
42 lastModified: comparison.metadata.publishedAt,
43 changeFrequency: "monthly" as const,
44 priority: 0.8,
45 }));
46
47 const landings = allUnrelated.map((page) => ({
48 url: `https://www.openstatus.dev/${page.slug}`,
49 lastModified: page.metadata.publishedAt,
50 changeFrequency: "monthly" as const,
51 priority: 0.7,
52 }));
53
54 const products = allProducts.map((product) => ({
55 url: `https://www.openstatus.dev/${product.slug}`,
56 lastModified: product.metadata.publishedAt,
57 changeFrequency: "weekly" as const,
58 priority: 0.9,
59 }));
60
61 const playgrounds = allPlaygrounds.map((playground) => ({
62 url: `https://www.openstatus.dev/play/${playground.slug}`,
63 lastModified: playground.metadata.publishedAt,
64 changeFrequency: "monthly" as const,
65 priority: 0.6,
66 }));
67
68 const guides = allGuides.map((guide) => ({
69 url: `https://www.openstatus.dev/guides/${guide.slug}`,
70 lastModified: guide.metadata.publishedAt,
71 changeFrequency: "monthly" as const,
72 priority: 0.6,
73 }));
74
75 const home = [
76 {
77 url: "https://www.openstatus.dev/",
78 lastModified: getHomePage().metadata.publishedAt,
79 changeFrequency: "daily" as const,
80 priority: 1.0,
81 },
82 ];
83
84 return [
85 ...home,
86 ...blogs,
87 ...changelogs,
88 ...comparisons,
89 ...landings,
90 ...products,
91 ...playgrounds,
92 ...guides,
93 ];
94}