SEO

Sitemap

How we generate the sitemap for the website.

The sitemap is generated by Next.js's built-in sitemap.ts support. The generator scans the project and creates entries for each kind of content:

Page Collection

The system first scans the app directory to collect all page routes:

  1. Reads all directories in the app folder
  2. Filters out:
    • Directories starting with underscore (_) which are typically internal/private routes
    • Directories starting with parentheses (() which are usually Next.js route groups
  3. Uses the remaining directory names as valid page routes

Content Collection

The system fetches content from the CMS to include in the sitemap:

Blog Posts

  • Fetches all published blog posts via blog.getPosts() from @repo/cms
  • Extracts the _slug from each post to generate URLs under /blog/
  • Fetches all legal pages via legal.getPosts() from @repo/cms
  • Extracts the _slug from each page to generate URLs under /legal/

Sitemap Generation

The final sitemap is generated by combining all these routes:

  1. Adds the base URL as the root entry
  2. Adds all page routes prefixed with the base URL
  3. Adds all blog posts under the blog/ path
  4. Adds all legal pages under the legal/ path

Each sitemap entry includes:

  • A full URL (combining the base URL with the route)
  • A lastModified timestamp (set to the current date)

The sitemap is automatically regenerated during each build, ensuring it stays up to date with your content.

On this page

GitHubEdit this page on GitHub