Skip to content

Commit

Permalink
Fixed sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
akhila-ariyachandra committed Oct 18, 2024
1 parent 0ab4f7a commit 93c30e6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { allPosts } from "content-collections";
import dayjs from "dayjs";
import type { MetadataRoute } from "next";

const sitemap = (): MetadataRoute.Sitemap => {
const posts = allPosts.map((post) => ({
url: `https://akhilaariyachandra.com/blog/${post._meta.path}`,
lastModified: post.updated
? post.updated.split("T")[0]
: post.posted.split("T")[0],
lastModified: dayjs(post.updated ?? post.posted).format("YYYY-MM-DD"),
}));

const routes = ["", "/blog"].map((route) => ({
url: `https://akhilaariyachandra.com${route}`,
lastModified: new Date().toISOString().split("T")[0],
lastModified: dayjs().format("YYYY-MM-DD"),
}));

return [...routes, ...posts];
Expand Down

0 comments on commit 93c30e6

Please sign in to comment.