-
Notifications
You must be signed in to change notification settings - Fork 7
Feat: Sitemap #422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v0-2
Are you sure you want to change the base?
Feat: Sitemap #422
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import type { MetadataRoute } from "next"; | ||
| import { | ||
| mainSource, | ||
| selfHostingSource, | ||
| platformSource, | ||
| guideSource, | ||
| openApiSource, | ||
| developingSource, | ||
| } from "../lib/source"; | ||
|
|
||
| export default function sitemap(): MetadataRoute.Sitemap { | ||
| const sources = [ | ||
| mainSource, | ||
| selfHostingSource, | ||
| platformSource, | ||
| guideSource, | ||
| openApiSource, | ||
| developingSource, | ||
| ]; | ||
|
|
||
| return sources.flatMap((s) => | ||
| s.getPages().map((page) => ({ | ||
| url: `https://docs.logchimp.codecarrot.net${page.url}`, | ||
| lastModified: new Date().toISOString(), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use actual modification dates instead of current timestamp. Setting Consider these alternatives:
+const buildTime = new Date().toISOString();
+
export default function sitemap(): MetadataRoute.Sitemap {
const sources = [
// ...
];
return sources.flatMap((s) =>
s.getPages().map((page) => ({
url: `https://docs.logchimp.codecarrot.net${page.url}`,
- lastModified: new Date().toISOString(),
+ lastModified: buildTime,
})),
);
}
lastModified: page.lastModified || buildTime,
🤖 Prompt for AI Agents |
||
| })), | ||
| ); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move hardcoded domain to environment variable.
The hardcoded domain
https://docs.logchimp.codecarrot.netcreates maintenance issues and will break in development or staging environments.Apply this diff to use an environment variable:
Then add
NEXT_PUBLIC_SITE_URLto your.envfiles for different environments.📝 Committable suggestion
🤖 Prompt for AI Agents