Sitemap
How we generate the sitemap for the website.
SuperStarter automatically generates the sitemap
for the website using Next.js’s built-in sitemap generation functionality (sitemap.ts
). The generation process scans different directories in the project and creates sitemap entries for various types of content:
Page Collection
If you add new pages or change the routes of your marketing pages, you need to make sure the sitemap reflects these changes.
You can find the configuration for the sitemap in the apps/web/config.ts
:
Content Collection
The system scans these directories:
Blog Posts
- Reads all files in the
content/blog
directory - Removes the
.mdx
extension from filenames
Docs Posts
- Reads all files in the
content/docs
directory - Removes the
.mdx
extension from filenames
Legal Pages
- Similarly scans the
content/legal
directory - Removes
.mdx
extensions
Sitemap Generation
The final sitemap is generated by combining all these routes:
- Adds the base URL as the root entry
- Adds all page routes defined in the
getSitemapConfig
object - Adds all blog posts under the
blog/
path - Adds all blog posts under the
docs/
path - 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)
There is one thing you need to pay attention to, whether you need to set the VERCEL_PROJECT_PRODUCTION_URL
environment variable, which will affect the domain of all URL in the sitemap. If your website is deployed on vercel, this variable will be automatically set to the domain name deployed by the project, and you can also manually set it to specify your domain name.
For web
application, it could be set like your-domain.com
, The value does not include the protocol scheme https://.
The url of your sitemap.xml generated will be: https://your-domain.com/sitemap.xml