Sitemap
Understanding and managing the automatically generated sitemap.
Sitemap (sitemap.xml
)
StarterKitPro utilizes Next.js's built-in support for generating a dynamic sitemap.xml
file.
Automatic Generation
The sitemap is generated automatically every time you build your application (e.g., during deployment). It intelligently includes:
- Static Routes: All your standard pages defined in the
app
directory (like/
,/blog
, etc.). - Dynamic Routes: If you are using features like the Blog or Documentation, the sitemap generator (located at
app/sitemap.ts
) is pre-configured to fetch and include URLs for all your published blog posts and documentation pages automatically. These content-rich sections are particularly important for SEO and discoverability.
This ensures that search engines always have an up-to-date list of the indexable content on your site without manual intervention.
Customization
While the automatic generation covers most cases, you might occasionally need to add specific URLs or modify the existing logic.
-
Add URLs: To add custom URLs, you can directly edit the
app/sitemap.ts
file. Locate the array where URLs are being compiled and add your new sitemap entry objects, following the existing format: -
Modify Logic: If you introduce new dynamic route structures, you might need to update the logic within
app/sitemap.ts
to fetch and format the URLs for those routes.
Why is a Sitemap Important?
A sitemap acts as a roadmap for search engines like Google, Bing, etc. It helps them:
- Discover Pages: Efficiently find all the important pages on your site, especially those that might not be easily reachable through standard crawling.
- Understand Structure: Get a better understanding of your site's hierarchy and organization.
- Index Content: Ensure that new or updated content (like new blog posts) gets indexed faster.
Submitting Your Sitemap
Once your site is deployed, the sitemap will be available at https://yourdomain.com/sitemap.xml
.
It's highly recommended to submit this URL to search engine webmaster tools:
- Google Search Console: Add your site property, navigate to "Sitemaps", enter
sitemap.xml
, and click "Submit". - Bing Webmaster Tools: Similar process; add your site and submit the
sitemap.xml
URL.
This helps search engines crawl and index your site more effectively.