-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds sitemap generation for main pages and contributor profiles (#462)
- Loading branch information
1 parent
34067f6
commit 7540892
Showing
3 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,7 @@ data-repo | |
|
||
# Package Lock | ||
package-lock.json | ||
yarn.lock | ||
yarn.lock | ||
|
||
# Files placed by data-repo | ||
/public/logo.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<MetadataRoute.Sitemap> { | ||
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, | ||
}), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { env } from "@/env.mjs"; | ||
import { MetadataRoute } from "next"; | ||
|
||
export const sitemapEntry = ( | ||
path: string, | ||
attrs: Omit<MetadataRoute.Sitemap[number], "url"> = {}, | ||
): 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 }), | ||
]; | ||
} |