XML Sitemap Best Practices: Everything You Need to Know
An XML sitemap is a file that tells search engines which pages on your site exist and should be crawled. While it's not a ranking factor, a well-configured sitemap improves crawl efficiency, speeds up indexing for new content, and helps large or complex sites ensure all important pages get discovered. This guide covers every aspect of sitemap creation, submission, and maintenance.
What Is an XML Sitemap?
An XML sitemap is a structured file (typically at /sitemap.xml) that lists URLs on your website. Each URL entry can include optional metadata:
<loc>— The full URL (required)<lastmod>— When the page was last modified<changefreq>— How often the page changes (daily, weekly, monthly)<priority>— Relative importance to other pages (0.0–1.0)
A basic sitemap entry looks like this:
<url> <loc>https://www.example.com/services/seo/</loc> <lastmod>2026-08-01</lastmod> <changefreq>monthly</changefreq> <priority>0.8</priority> </url>
Do You Need a Sitemap?
Google says a sitemap is particularly helpful if:
- Your site is large (more than 500 pages)
- Your site is new and has few external backlinks
- Your site has pages that aren't well-connected through internal links (orphan pages)
- Your site has rich media content (video, images)
For small sites with good internal linking and external backlinks, Google will likely find all pages without a sitemap. But submitting one costs nothing and provides benefits, so there's no good reason to skip it.
What to Include in Your Sitemap
DO Include
- Homepage
- All canonical pages (the version Google should index)
- Service and product pages
- Blog posts and content pages
- Location pages
- Category pages
- Important landing pages
DO NOT Include
- Non-canonical URLs (pages that have a canonical tag pointing elsewhere)
- Pages with a
noindexmeta tag or X-Robots-Tag header - Duplicate content URLs
- URL parameter variations (e.g.,
?sort=price,?ref=newsletter) - Paginated pages beyond page 1 (in most cases)
- Admin pages, login pages, account pages
- Thank-you pages and order confirmation pages
- Staging/test environments
- 404 error pages
- Pages blocked by robots.txt
The most common sitemap mistake is including non-canonical and noindex URLs. This sends confusing signals to Google: your sitemap says "index this" but the page says "don't index this." Always keep your sitemap and your noindex/canonical directives consistent.
Sitemap Size Limits
Google and Bing have official limits:
- Maximum 50,000 URLs per sitemap file
- Maximum 50MB (uncompressed) per sitemap file
If your site exceeds these limits, use a sitemap index file. A sitemap index is a master sitemap that points to multiple child sitemaps:
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemap-posts.xml</loc>
<lastmod>2026-08-15</lastmod>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap-products.xml</loc>
<lastmod>2026-08-15</lastmod>
</sitemap>
</sitemapindex>
Submit only the sitemap index URL to Google Search Console — GSC will discover the child sitemaps automatically.
Sitemap Types
Standard XML Sitemap
The default type covering web pages. Works for all content types.
Image Sitemap
Include image tags within page entries to help Google discover images, especially those loaded via JavaScript:
<url>
<loc>https://www.example.com/gallery/</loc>
<image:image>
<image:loc>https://www.example.com/images/hero.jpg</image:loc>
<image:title>Our Denver SEO Team</image:title>
</image:image>
</url>
Video Sitemap
For sites with video content, video sitemaps provide metadata (title, description, thumbnail URL, duration) that helps Google understand and index video content.
News Sitemap
For Google News publishers: lists articles published in the last 48 hours with publication date, title, and language. Requires Google News approval.
lastmod: Use It Accurately or Not At All
The lastmod attribute is valuable when accurate — it tells Google when a page's content changed, which can trigger faster recrawling. But many CMS platforms update lastmod automatically on every page whenever any site-wide change occurs (like a footer update). This causes all pages to show today's date, which teaches Google to ignore your lastmod entirely.
Best practice: Only use lastmod if you can accurately reflect when the page content was meaningfully changed. If your CMS can't do this accurately, omit lastmod entirely rather than provide misleading dates.
changefreq and priority: Less Important Than You Think
Google has publicly stated that it largely ignores changefreq and priority hints. These were designed to guide crawl scheduling, but Google's crawl algorithms are sophisticated enough to determine crawl frequency independently.
You can include them for completeness (some minor crawlers still use them), but don't invest significant effort in tuning these values. A priority of 0.5 for all pages and omitting changefreq entirely is perfectly acceptable.
Dynamic vs. Static Sitemaps
Dynamic Sitemaps
Generated in real-time by your CMS or web framework. As you add new pages or posts, they automatically appear in the sitemap. Best for sites that update frequently. Examples: WordPress with Yoast SEO, Next.js with next-sitemap package.
Static Sitemaps
Pre-generated XML files uploaded to your server. Simpler to implement but require manual or automated regeneration when content changes. Best for simple sites with infrequent updates.
Programmatic Sitemap Generation
For large sites (10,000+ pages), sitemaps are typically generated from database queries during build processes. For example, in Next.js App Router:
// app/sitemap.ts
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const posts = await getAllPosts(); // fetch from database
return posts.map((post) => ({
url: \`https://www.example.com/blog/\${post.slug}/\`,
lastModified: post.updatedAt,
}));
}
Submitting Your Sitemap
Google Search Console
- Log in to GSC and select your property
- Navigate to Indexing → Sitemaps
- Enter your sitemap URL (usually /sitemap.xml) and click Submit
- Check back after 24-48 hours to see if it was processed successfully
Bing Webmaster Tools
Submit your sitemap at webmaster.bing.com in the Sitemaps section. Bing requires separate submission from Google.
robots.txt Sitemap Reference
Add your sitemap URL to robots.txt so any crawler can find it without explicit submission:
Sitemap: https://www.revealrank.com/sitemap.xml
Monitoring Sitemap Health in GSC
After submission, monitor GSC's Sitemaps report regularly:
- Submitted vs. Indexed: A large gap (submitted 500, indexed 100) indicates many pages aren't being indexed — investigate why
- Errors: GSC will flag if your sitemap file has formatting errors or if URLs return errors
- Last read date: GSC shows when Googlebot last fetched your sitemap; if it's stale, check if your sitemap URL is correct
A healthy sitemap should show indexed count within 20% of submitted count for most sites. Large discrepancies signal issues with content quality, canonicalization, or technical blocking.
Sitemap Validation
Before submitting, validate your sitemap:
- W3C XML Validator: checks formatting
- Google Search Console's URL Inspection: checks if specific pages in your sitemap are indexable
- Screaming Frog can crawl your sitemap and flag issues
Common validation errors to fix:
- Missing required namespace declaration
- URLs that don't start with your verified property URL
- Pages returning non-200 status codes
- Special characters not properly escaped (use & not & in URLs)
Proper sitemap management is part of a comprehensive technical SEO foundation. Pair it with an SEO audit and proper technical SEO implementation to ensure Google can efficiently discover and index everything that matters on your site.
📚 More from RevealRank
Explore related guides and services to go deeper on this topic.
rank higher on google maps
Google Business Profile Optimization: The Complete Guide to Ranking on Google Maps
how much does seo cost
How Much Does SEO Cost? Real Pricing for Every Budget Level in 2026
seo audit checklist
SEO Audit Checklist: The Complete Framework for Diagnosing Any Website
Service
Technical SEO
Service
Local SEO
