Skip to main content
Back to blog

XML Sitemap Guide: Create and Submit

What Is an XML Sitemap?

An XML sitemap is a file that lists all important pages on your website. It helps search engines discover and crawl your content efficiently.

Basic Sitemap

<?xml version="1.0" encoding="UTF-8"?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

  <url>
    <loc>https://yoursite.com/</loc>
    <lastmod>2026-03-20</lastmod>
    <priority>1.0</priority>
  </url>
  <url>
    <loc>https://yoursite.com/about</loc>
    <lastmod>2026-03-15</lastmod>
    <priority>0.8</priority>
  </url>

</urlset>

Next.js Sitemap (app/sitemap.ts)

export default function sitemap() {

return [

    { url: 'https://yoursite.com', lastModified: new Date() },
    { url: 'https://yoursite.com/about', lastModified: new Date() },

];

}

Submit to Google

1. Go to Google Search Console

2. Click "Sitemaps" in the left menu

3. Enter your sitemap URL: `https://yoursite.com/sitemap.xml`

4. Click "Submit"

Best Practices

1. **Include only canonical URLs** — No duplicate or redirected URLs

2. **Keep under 50,000 URLs** — Use sitemap index for larger sites

3. **Update lastmod dates** — Only when content actually changes

4. **Reference in robots.txt** — Add `Sitemap: https://yoursite.com/sitemap.xml`

5. **Don't include noindex pages** — Only pages you want indexed

Check if your sitemap exists and is properly configured with [SEO Snapshot](/).

Check your site's SEO score for free

Analyze your site