-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0963885
commit d48bb83
Showing
1 changed file
with
36 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { MetadataRoute } from "next"; | ||
|
||
import { BASE_PATH, BASE_URL } from "@/next.constants.mjs"; | ||
|
||
// This is the combination of the Application Base URL and Base PATH | ||
const baseUrlAndPath = `${BASE_URL}${BASE_PATH}`; | ||
|
||
// This allows us to generate a `sitemap.xml` file dynamically based on the needs of the Node.js Website | ||
// Next.js Sitemap Generation doesn't support `alternate` refs yet | ||
// @see https://github.com/vercel/next.js/discussions/55646 | ||
const sitemap = async (): Promise<MetadataRoute.Sitemap> => { | ||
const staticUrls = [ | ||
"", | ||
"legal/terms", | ||
"legal/support-terms", | ||
"legal/sla", | ||
"legal/privacy-policy", | ||
"sign-in", | ||
"sign-up", | ||
"about", | ||
"help", | ||
]; | ||
const currentDate = new Date().toISOString(); | ||
|
||
return [...staticUrls].map((route) => ({ | ||
url: `${baseUrlAndPath}${route}`, | ||
lastModified: currentDate, | ||
changeFrequency: "always", | ||
})); | ||
}; | ||
|
||
export default sitemap; | ||
|
||
// Enforces that this route is used as static rendering | ||
// @see https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic | ||
export const dynamic = "error"; |