sitemap.ts). The generation process scans different directories in the project and creates sitemap entries for various types of content:
Page Collection
The system first scans theapp directory to collect all page routes:
- Reads all directories in the
appfolder - Filters out:
- Directories starting with underscore (
_) which are typically internal/private routes - Directories starting with parentheses (
() which are usually Next.js route groups
- Directories starting with underscore (
- Uses the remaining directory names as valid page routes
Content Collection
The system then scans two content directories:Blog Posts
- Reads all files in the
content/blogdirectory - Filters out:
- Directory entries (only wants files)
- Files starting with underscore
- Files starting with parentheses
- Removes the
.mdxextension from filenames
Legal Pages
- Similarly scans the
content/legaldirectory - Applies the same filtering rules as blog posts
- Removes
.mdxextensions
Sitemap Generation
The final sitemap is generated by combining all these routes:- Adds the base URL as the root entry
- Adds all page routes prefixed with the base URL
- Adds all blog posts under the
blog/path - Adds all legal pages under the
legal/path
- A full URL (combining the base URL with the route)
- A
lastModifiedtimestamp (set to the current date)