diff --git a/.gitignore b/.gitignore index 24103bb9..a967a68a 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,7 @@ data-repo # Package Lock package-lock.json -yarn.lock \ No newline at end of file +yarn.lock + +# Files placed by data-repo +/public/logo.png \ No newline at end of file diff --git a/app/contributors/sitemap.ts b/app/contributors/sitemap.ts new file mode 100644 index 00000000..80ff7024 --- /dev/null +++ b/app/contributors/sitemap.ts @@ -0,0 +1,15 @@ +import { sitemapEntry } from "@/app/sitemap"; +import { getContributors, getContributorsSlugs } from "@/lib/api"; +import { MetadataRoute } from "next"; + +export default async function sitemap(): Promise { + const contriutors = await getContributors(); + return contriutors.map((contributor) => + sitemapEntry(`/contributors/${contributor.github}`, { + lastModified: contributor.activityData.last_updated + ? new Date(contributor.activityData.last_updated) + : undefined, + priority: 0.8, + }), + ); +} diff --git a/app/sitemap.ts b/app/sitemap.ts new file mode 100644 index 00000000..dd801617 --- /dev/null +++ b/app/sitemap.ts @@ -0,0 +1,29 @@ +import { env } from "@/env.mjs"; +import { MetadataRoute } from "next"; + +export const sitemapEntry = ( + path: string, + attrs: Omit = {}, +): MetadataRoute.Sitemap[number] => { + return { + changeFrequency: "daily", + lastModified: new Date(), + priority: 1, + ...attrs, + url: `${env.NEXT_PUBLIC_META_URL}${path}`, + }; +}; + +const entry = sitemapEntry; + +export default function sitemap(): MetadataRoute.Sitemap { + return [ + entry("/"), + entry("/people"), + entry("/projects"), + entry("/releases"), + entry("/leaderboard"), + entry("/issues"), + entry("/feed", { changeFrequency: "always", priority: 0.7 }), + ]; +}