Skip to content

Commit

Permalink
feat: sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
leMedi committed May 16, 2024
1 parent 38f06ea commit 1f9fb26
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions apps/nextjs/src/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { allPosts } from "contentlayer/generated";
import type { MetadataRoute } from "next";

export default function sitemap(): MetadataRoute.Sitemap {
const posts = allPosts
.filter((post) => post.published)
.sort((a, b) => b.date.localeCompare(a.date))
.map((post) => ({
url: `https://recaply.io/${post.url}`,
lastModified: new Date(post.date),
changeFrequency: "weekly" as const,
priority: 0.5,
}));

return [
{
url: "https://recaply.io/",
lastModified: new Date(),
changeFrequency: "monthly",
priority: 1,
},
{
url: "https://recaply.io/dashboard",
lastModified: new Date(),
changeFrequency: "monthly",
priority: 0.8,
},
{
url: "https://recaply.io/blog",
lastModified: new Date(),
changeFrequency: "weekly",
priority: 0.5,
},

...posts,
];
}

0 comments on commit 1f9fb26

Please sign in to comment.