Skip to content

Commit

Permalink
Add sitemap (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
rangelfinal authored Sep 20, 2023
1 parent dfc0017 commit 64d0969
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { MetadataRoute } from "next";
import { ChecklistService } from "@/services/checklist";

export default function sitemap(): MetadataRoute.Sitemap {
const checklistPaths = ChecklistService.getInstance().getChecklistFiles();

return checklistPaths.map(({ slug, lang, lastModified }) => ({
url: `https://devchecklists.com/${lang}/checklist/${slug}`,
lastModified,
}));
}
3 changes: 3 additions & 0 deletions src/services/checklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ interface ChecklistFile {
slug: string;
path: string;
lang: string;
lastModified: Date;
}

export interface Checklist {
Expand Down Expand Up @@ -273,6 +274,7 @@ export class ChecklistService {
files.push({
slug: checklistFolder,
path: checklistFilePath,
lastModified: checklistFileStat.mtime,
lang: "en",
});
continue;
Expand All @@ -291,6 +293,7 @@ export class ChecklistService {
files.push({
slug: checklistFolder,
path: checklistFilePath,
lastModified: checklistFileStat.mtime,
lang,
});
}
Expand Down

0 comments on commit 64d0969

Please sign in to comment.