Skip to main content
SlapMyWeb
Fix Guide

How to Add an XML Sitemap

Publish a list of the URLs you want discovered, and tell search engines where it is.

Easy Medium Impact 30 min

A missing XML sitemap does not stop a site being indexed, but it removes the fastest route to discovery — which matters most for large sites and for pages few internal links point at. The sitemap should list only canonical, indexable URLs; including redirects or noindex pages weakens the signal it carries.

Why It Matters

Around half of audited sites have no sitemap. It is also a diagnostic: Search Console reports how many submitted URLs were indexed, which is the clearest available answer to "is Google actually taking these pages".

How to Fix

1

Generate it from real data

Build the list from your actual published content so it cannot drift. A hand-maintained sitemap is out of date within a month.
2

Include only indexable canonicals

No redirects, no noindex pages, no parameter variants. Every entry should be a URL you want indexed exactly as written.
3

Split it if it is large

50,000 URLs or 50 MB per file. Beyond that use a sitemap index pointing at several files.
4

Advertise and submit it

Add a Sitemap: line to robots.txt and submit it in Search Console and Bing Webmaster Tools.

Code Fix

xml
Before (broken)
GET /sitemap.xml -> 404
After (fixed)
<?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-09-03</lastmod>
  </url>
</urlset>

Platform-Specific Instructions

WordPress

WordPress generates one at /wp-sitemap.xml; most SEO plugins replace it with their own. Do not leave both live.

Next.js

app/sitemap.ts generates it. Read the URL list from your content source rather than hardcoding it.

Fixed that one.
Now find the rest.

A free audit ranks every issue on your site by the score points it costs — and links each one straight to its guide.

Run a free audit
Free foreverNo signupResults in 30s