This guide explains the steps to keep the sitemap up to date when adding, modifying, or removing a page or URL on the Dying Star website.
- Define the route in the link configuration file (
@feat/navigation/Links). - Create a generator function in
app/sitemap.tsxfor this new page, following the model of existing functions (generateHomePageEntries, etc.). - Add a call to this function in the main
sitemapfunction to include the new page in the sitemap. - Check language handling: use
createSitemapEntriesto generate localized URLs.
- Update the route in
@feat/navigation/Links. - Adapt the corresponding generator function in
app/sitemap.tsxif the path or logic changes. - Check alternates (multilingual links) to ensure they point to the correct paths.
- Test the sitemap to ensure the modified page appears correctly.
- Remove the corresponding generator function in
app/sitemap.tsx. - Delete the route in
@feat/navigation/Linksif it is no longer used. - Check the main
sitemapfunction to remove any call to the deleted function. - Ensure the sitemap no longer references the old page.
- Always check the generated sitemap after each change (e.g.,
/sitemap.xml). - Maintain consistency of alternates for multilingual SEO.
- Document any important changes in the
app/sitemap.mdfile.
-
createSitemapEntryis a utility function that creates a single sitemap entry for a specific URL. It allows you to specify the URL, last modification date, change frequency, and optionally alternate language links for that entry. -
createSitemapEntriesis a higher-level function that generates an array of sitemap entries for all supported locales for a given path. It usescreateSitemapEntryinternally for each locale, ensuring that each localized version of the page is included in the sitemap, along with the appropriate alternate language links.
In summary, use createSitemapEntry for a single URL, and createSitemapEntries to automatically handle all locales for a given route.
By following this guide, the sitemap will remain up to date and accurately reflect the site structure, which is essential for SEO and user navigation.