An XML sitemap is a structured file — formatted in Extensible Markup Language — that provides search engines with a roadmap of all the important pages on your website. Think of it as a table of contents that tells Google, Bing, and other search engines exactly where to find your content and how often it changes.
What Goes Into an XML Sitemap
A standard XML sitemap contains a list of URLs, each accompanied by optional metadata: the last modification date (lastmod), how frequently the page changes (changefreq), and a priority score (0.0 to 1.0) indicating relative importance. While Google has stated it largely ignores changefreq and priority, the lastmod signal is genuinely useful — it tells Googlebot to recrawl updated pages sooner.
Modern sitemaps can also be specialized: image sitemaps reference media files, video sitemaps help YouTube and Google Video, and news sitemaps surface recent articles to Google News. Large sites often use sitemap index files — a master sitemap that points to multiple sub-sitemaps, each containing up to 50,000 URLs.
Why Sitemaps Matter for SEO
Sitemaps are not a ranking factor, but they are a critical indexing factor. Search engines discover new pages in two ways: following internal links and crawling sitemaps. For new websites without many external backlinks, sitemaps are often the fastest route to getting content indexed.
- New websites: Google may not discover pages through links alone — sitemaps accelerate initial discovery
- Large sites: With thousands of pages, sitemaps ensure important pages aren't overlooked
- Orphaned pages: Content with few or no internal links needs sitemap inclusion to be found
- Rich media: Images and videos need dedicated sitemaps to appear in Google Images and Video search
How to Create an XML Sitemap
Modern content management systems (WordPress, Sanity, Contentful) and frameworks (Next.js) generate sitemaps automatically. For Next.js specifically, you can export a sitemap.ts or sitemap.js file in the app directory — this is exactly how Sagara builds sitemaps for our clients' sites.
If you're managing a site manually, tools like Screaming Frog, Yoast SEO (WordPress), or online generators can create sitemaps. The key rules are: only include canonical URLs, only include indexable pages (no noindex pages), and keep the file under 50MB or 50,000 URLs per sitemap file.
Submitting Your Sitemap to Google
Once created, submit your sitemap via Google Search Console: navigate to Sitemaps in the left sidebar and enter your sitemap URL. This is a manual nudge to Googlebot — Google will still discover your sitemap via robots.txt, but manual submission speeds things up significantly.
Place your sitemap reference in robots.txt for automatic discovery:
Sitemap: https://www.yourdomain.com/sitemap.xml
Sitemap Best Practices
- Only include URLs that return 200 status codes — no redirects or error pages
- Exclude low-value pages: admin panels, search result pages, filtered/faceted URLs
- Keep lastmod dates accurate — wrong dates erode Google's trust in your signals
- Use hreflang in sitemap for multilingual sites to signal language/region targeting
- Resubmit to Google Search Console after major site restructures
- For dynamic sites, automate sitemap generation so new content appears instantly
At Sagara, every website we build includes automated, force-dynamic sitemaps that update in real time as new content is published. This ensures Googlebot discovers and indexes new pages as quickly as possible, directly supporting our clients' organic growth goals.