A sitemap is a discovery hint, not an indexing guarantee. Search engines can often discover well-linked pages without one, but a sitemap is useful for larger sites, new sites, complex navigation, and media-rich content. Include only URLs you want considered for indexing.
Before You Begin
- A list of canonical, indexable URLs.
- A stable public HTTPS location for the sitemap.
- Access to your site deployment and Google Search Console if using Google.
Recommended Approach
1. Choose URLs carefully
Include canonical pages that return successful responses and are intended for search. Exclude redirects, error pages, duplicate parameter URLs, private pages, and URLs marked noindex.
2. Generate valid XML
Use the sitemap protocol namespace and one `url` element per page. Include an absolute URL in `loc`. Add `lastmod` only when you can provide a truthful modification date.
3. Split large sitemaps when needed
A sitemap file is limited to 50,000 URLs or 50 MB uncompressed. Use a sitemap index to reference multiple sitemap files when the site grows beyond those limits.
4. Publish and reference it
Place the sitemap at a stable location such as `/sitemap.xml`. You may reference it in robots.txt and submit it in Google Search Console. Ensure the file is accessible to crawlers.
5. Validate and maintain
Check XML syntax, response status, canonical consistency, and whether URLs are indexable. Regenerate the sitemap when pages are added, removed, redirected, or materially updated.
Operational Considerations
Search visibility and website quality improve through consistent maintenance rather than one-time submissions. Keep important pages linked from relevant navigation and related articles, use descriptive titles and headings, and ensure that each page has a clear purpose. Review canonical URLs, redirects, internal links, and indexability when content is moved or reorganized. Keep a change history so a sudden drop in visibility or performance can be compared with recent releases.
How to Verify the Result
Use Search Console and performance tools as diagnostic sources, not as a promise of a particular ranking or indexing date. Compare trends over time, inspect representative URLs, and distinguish crawling, indexing, ranking, and user engagement. After making a change, verify the live response and rendered page, then monitor the relevant report rather than repeatedly submitting the same URL.
Example Configuration
Illustrative example — adapt values to your environment
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/resources/example-guide</loc>
<lastmod>2026-11-29</lastmod>
</url>
</urlset>
Common Mistakes to Avoid
- A sitemap does not force Google to crawl or index a URL.
- Do not list URLs that redirect, return errors, or are blocked from indexing.
- Do not update lastmod on every build if the page content did not change.
Make one change at a time, test it from the perspective of the actual user or application, and record the reason for the change. Keep a rollback path for network, identity, and production configuration changes.
Final Checklist
- The configuration matches the intended environment and service version.
- Access is limited to the required identities, resources, ports, and operations.
- The expected workflow has been tested, including a negative test for unauthorized access.
- Secrets and temporary credentials are protected and excluded from logs and source control.
- The configuration owner, purpose, and review or expiration date are documented.