XML Sitemaps: How to Create & Submit Yours
An XML sitemap is a file that lists all important pages on your website. It helps search engines discover and index your content more efficiently, especially for large or new sites.
Last updated: February 20, 2026
Quick Summary
- XML sitemaps help Google discover pages it might miss through normal crawling
- Submit your sitemap via Google Search Console for fastest indexing
- Reference your sitemap in robots.txt: Sitemap: https://yoursite.com/sitemap.xml
- Update your sitemap automatically when you add or remove pages
Does your site have this issue?
Run a free scan to find out.
What is an XML sitemap?
An XML sitemap is a file (usually at /sitemap.xml) that lists the URLs of important pages on your website along with metadata like last modification date and update frequency:
xml<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-02-20</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/about</loc>
<lastmod>2026-01-15</lastmod>
</url>
</urlset>Think of it as a roadmap that tells search engines: "Here are all the pages I want you to know about."
Why sitemaps matter for SEO
Discovery: Sitemaps help Google find pages that are not easily discoverable through links alone. New pages, deep pages, and orphaned pages all benefit.
Crawl efficiency: Instead of crawling your entire site to find pages, Google can read your sitemap to prioritize crawling.
Indexing speed: New content gets indexed faster when Google knows about it through your sitemap.
When sitemaps are critical: - New websites with few external backlinks - Large sites with 500+ pages - Sites with deep page hierarchies - E-commerce sites with product pages - Sites that publish content frequently
How to create a sitemap
Next.js (built-in):
``typescript
// app/sitemap.ts
export default function sitemap() {
return [
{ url: "https://yoursite.com", lastModified: new Date() },
{ url: "https://yoursite.com/about", lastModified: new Date() },
]
}
``
WordPress: Install Yoast SEO or Rank Math - both auto-generate sitemaps.
Manual: Create a sitemap.xml file following the sitemaps.org protocol.
Generators: Use tools like xml-sitemaps.com for small static sites.
Important rules: - Maximum 50,000 URLs per sitemap file - Maximum 50MB (uncompressed) per file - Use sitemap index files for larger sites - Include only canonical, indexable URLs - Do not include noindex pages or redirects
How to submit your sitemap to Google
Method 1: Google Search Console (recommended) 1. Go to Google Search Console 2. Select your property 3. Navigate to "Sitemaps" in the left menu 4. Enter your sitemap URL (e.g., /sitemap.xml) 5. Click "Submit"
Method 2: robots.txt
Add this line to your robots.txt file:
``
Sitemap: https://yoursite.com/sitemap.xml
``
Google automatically checks robots.txt for sitemap references.
Method 3: Ping Google
Send a request to:
``
https://www.google.com/ping?sitemap=https://yoursite.com/sitemap.xml
``
Best practice: Use all three methods for maximum coverage.
Official Google Sources
Frequently Asked Questions
Does having a sitemap guarantee Google will index my pages?
No. A sitemap is a suggestion, not a directive. Google may still choose not to index certain pages if they lack quality, have duplicate content, or violate guidelines.
How often should I update my sitemap?
Your sitemap should update automatically whenever you add, remove, or significantly update a page. Most CMS platforms and frameworks handle this automatically.
Should I include every page in my sitemap?
Include only canonical, indexable pages. Do not include pages with noindex, redirected pages, error pages, or low-value utility pages like login forms.
My site is small. Do I still need a sitemap?
Yes. Even small sites benefit from sitemaps. Google can usually crawl small sites without one, but a sitemap ensures nothing is missed and helps with indexing speed.
Related Guides
Ready to fix this on your site?
Our scanner checks for this and 150+ other ranking factors automatically.
Get Started Free