XML Sitemap: What It Is and How to Create One
An XML sitemap helps search engines discover and index your website pages efficiently.
What is a Sitemap?
A sitemap is an XML file that lists all important pages on your website. It acts as a roadmap for search engine crawlers like Google, Bing, and Yahoo.
Benefits
- Faster indexing - Search engines find new pages quickly
- Better crawling - Ensures all pages are discovered
- Priority signals - Indicate which pages are most important
- Update frequency - Tell crawlers how often content changes
Creating a Sitemap
WordPress (Easiest Method)
Using Yoast SEO:
- Install and activate Yoast SEO plugin
- Go to SEO → General → Features
- Enable "XML sitemaps"
- Your sitemap is at: yourdomain.com/sitemap_index.xml
Using Rank Math:
- Install Rank Math plugin
- Go to Rank Math → Sitemap Settings
- Enable sitemap module
- Access at: yourdomain.com/sitemap_index.xml
Manual Creation
Create a file named sitemap.xml in your root directory:
xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://yourdomain.com/</loc>
<lastmod>2024-01-15</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://yourdomain.com/about</loc>
<lastmod>2024-01-10</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>Online Generators
For static sites, use free generators:
- XML-Sitemaps.com
- Screaming Frog (desktop tool)
- Sitemap Generator by Small SEO Tools
Submitting to Search Engines
Google Search Console
- Go to search.google.com/search-console
- Add and verify your property
- Go to Sitemaps → Add a new sitemap
- Enter: sitemap.xml (or your sitemap URL)
- Click Submit
Bing Webmaster Tools
- Go to bing.com/webmasters
- Add your site
- Navigate to Sitemaps
- Submit your sitemap URL
robots.txt Reference
Add to your robots.txt file:
Sitemap: https://yourdomain.com/sitemap.xmlSitemap Best Practices
- Keep it under 50MB - Split into multiple sitemaps if needed
- Maximum 50,000 URLs - Use sitemap index for larger sites
- Only include canonical URLs - No duplicates or redirects
- Update regularly - Reflect actual content changes
- Use HTTPS URLs - Match your site's protocol
Checking Sitemap Status
In Google Search Console
- Go to Sitemaps
- View submitted sitemaps
- Check "Discovered URLs" vs "Indexed URLs"
- Review any errors or warnings
Common Issues
- 404 errors - Remove deleted pages from sitemap
- Non-canonical URLs - Use canonical version only
- Blocked by robots.txt - Ensure sitemap is accessible
- Wrong format - Validate XML syntax
Sitemap Types
| Type | Purpose | Example |
|---|---|---|
| Standard | Web pages | sitemap.xml |
| Image | Images for Google Images | sitemap-images.xml |
| Video | Video content | sitemap-videos.xml |
| News | News articles | sitemap-news.xml |
Monitoring & Maintenance
- Check Search Console monthly
- Update after major site changes
- Remove outdated URLs
- Monitor indexing coverage
- Fix reported errors promptly