AmarnepalNepal Data
Technical SEOBeginner · 9 min read · Reviewed by the Amarnepal Editorial Team · verified 2026-08-11

XML sitemaps explained: create, submit and troubleshoot

An XML sitemap is a list of URLs you hand to search engines as a discovery hint, not a ranking lever. Covers what a sitemap actually does, how to generate one with a WordPress plugin or by hand for a custom site, submitting it in Google Search Console, and fixing the specific errors that show up once it's live.

An XML sitemap is a plain list of URLs, wrapped in a bit of XML, that tells search engines which pages exist and roughly when they last changed. That's the entire job. It does not make a page rank higher, it does not force indexing, and it does not fix a page that's broken, thin, or blocked elsewhere. Treat it as a discovery aid and you'll use it correctly; treat it as a lever and you'll waste time chasing the wrong fix when pages don't get indexed.

Where it does earn its keep: large sites, new sites with few inbound links pointing at internal pages, and sites where the internal linking is weak enough that Googlebot might not otherwise stumble onto a given URL quickly. A five-page brochure site barely needs one. A 4,000-product catalog does.

This guide covers what a sitemap actually contains, how to generate one on WordPress and on a custom site, how to submit it in Search Console, and how to read the three errors that come up most often once real data starts arriving.

What a sitemap does, and the misconception to drop

A sitemap is a discovery and crawl-scheduling hint. Google's own documentation is explicit about this: submitting a sitemap doesn't guarantee that all the URLs in it will be crawled or indexed, and inclusion in a sitemap is not a ranking signal at all. It's a list of candidates, not a queue that Google works through in order.

The misconception worth killing early: 'my page isn't ranking, let me check if it's in the sitemap.' Being in the sitemap has nothing to do with ranking, and often nothing to do with indexing either if the page has other problems, thin content, a noindex tag, a canonical pointing elsewhere, low perceived quality. A sitemap gets a page in front of the crawler faster. It does not make Google like the page.

What a sitemap does concretely: it exposes URLs Google might not find through normal link crawling, it communicates lastmod dates so Google can prioritize re-crawling changed pages over static ones, and on very large sites it can be split by content type so you can diagnose indexing problems by section in Search Console rather than staring at one undifferentiated list.

The bare structure

A minimal sitemap is just this, one <url> block per page:

  • <?xml version="1.0" encoding="UTF-8"?>
  • <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  • <url>
  • <loc>https://example.com/page</loc>
  • <lastmod>2026-08-01</lastmod>
  • </url>
  • </urlset>

Generating a sitemap on WordPress

If the site runs on Yoast SEO, Rank Math, or All in One SEO, a sitemap is already being generated automatically at /sitemap_index.xml (Yoast, Rank Math) the moment the plugin is active, no separate setup step needed for the file itself. What actually needs attention is the settings that control what goes into it.

Check three things in the plugin's sitemap settings: that post types you don't want indexed (attachments, some custom post types, internal utility pages) are excluded from the sitemap, that noindexed pages are automatically dropped from it (all three major plugins do this by default, but verify after any bulk content changes), and that pagination and archive pages aren't bloating the file with low-value URLs.

A common WordPress mistake is running two SEO plugins at once, each generating its own sitemap at a different path, and submitting both to Search Console. Pick one plugin, deactivate the other's sitemap module if it lingers, and submit a single sitemap index.

Generating a sitemap for a custom site

Without a CMS plugin, you're either generating the file at build time (static sites, Next.js, Astro) or serving it dynamically from a route that queries your database of published URLs.

For a static or server-rendered site, the practical approach is a small script that runs on deploy: pull every canonical, indexable URL from your content source, write out the <url> blocks, and write the file to the public root. Most frameworks have a documented sitemap convention (a sitemap.xml route or a config-driven generator) rather than requiring you to hand-roll the XML each time.

Whatever the mechanism, the rule is the same: the sitemap should only contain URLs that return a 200 status, are canonical (not duplicates pointing elsewhere via rel=canonical), and are not noindexed. Anything else pollutes the file and wastes crawl attention on URLs that were never going to get indexed anyway.

A single sitemap file is capped at 50,000 URLs and 50MB uncompressed. Past that, split into multiple sitemap files and list them in a sitemap index file, which is itself just a list of sitemap URLs.

Submitting it in Google Search Console

In Search Console, go to Sitemaps in the left sidebar, enter the path relative to your verified property (just 'sitemap.xml' or 'sitemap_index.xml', not the full URL), and submit. Google fetches it, and the status updates from 'Pending' to 'Success' or an error state, usually within a few minutes to a few hours.

Also reference the sitemap's absolute URL in robots.txt with a Sitemap: line. This isn't redundant with the Search Console submission, some crawlers other than Googlebot only discover sitemaps through robots.txt, and it's a one-line addition.

  • Confirm the site is a verified property in Search Console before submitting anything.
  • Open Sitemaps under Indexing in the sidebar.
  • Enter the sitemap path and click Submit.
  • Wait for status to move from Pending to Success, then check the discovered URL count against your actual page count.
  • Add a Sitemap: line pointing to the full sitemap URL in robots.txt.

Troubleshooting: "Submitted URL not indexed"

This means Google saw the URL in your sitemap but chose not to index it. This is the most common sitemap-related report and almost never means the sitemap itself is broken.

Start with URL Inspection on the specific URL. It will usually tell you why: low-value content relative to similar pages already indexed, a duplicate of a canonical Google chose elsewhere, or a page Google crawled but assessed as not worth storing. Check whether the page has thin or near-duplicate content compared to other pages on the site, whether internal links actually point to it (a page only reachable via the sitemap and nowhere else in your site's link structure is a weak signal), and whether the page returns useful content on first render, not just after client-side JavaScript finishes.

Resubmitting the sitemap does nothing here. The fix is improving the page or the links pointing at it, not resubmitting the file.

Troubleshooting: "Submitted URL marked 'noindex'"

This one is unambiguous: the URL is in your sitemap, but the page itself carries a noindex directive, either in a meta robots tag or an X-Robots-Tag HTTP header. Google is telling you the two signals contradict each other and it's obeying the noindex.

Check the page's rendered HTML source for <meta name="robots" content="noindex">. If it's not there, check response headers for an X-Robots-Tag, this is often set at the server or CDN level and invisible in the page source, so view-source won't catch it, you need to inspect the actual HTTP response.

The most frequent cause is a staging environment's noindex setting migrating to production, common with WordPress's 'Discourage search engines' toggle under Settings > Reading getting left on after launch, or a CDN/reverse-proxy rule written for a staging subdomain that got applied site-wide. Fix the directive, then remove the URL from the sitemap only if it should actually stay out of the index, otherwise leave it in and let Google re-crawl once the noindex is gone.

Troubleshooting: sitemap not readable

Search Console reports errors like 'Couldn't fetch', 'General HTTP error', or 'Sitemap is not in a supported format' when it can't parse or reach the file at all. Work through these in order.

Fetch the sitemap URL directly in a browser and confirm it returns a 200 status and valid XML, not a 404, a redirect, or an HTML error page rendered with a 200 status (a common false-positive where the server returns a friendly error page instead of an actual 404). Validate the XML is well-formed: an unescaped ampersand in a URL, a missing closing tag, or wrong character encoding will break parsing entirely. Confirm the sitemap isn't blocked by robots.txt, a Disallow rule covering the sitemap's own path will stop Google from fetching it. Check that the file is served with an XML or text content type rather than something the fetcher rejects, and that it's under the 50MB/50,000-URL cap, oversized files can time out or fail silently depending on server configuration.

If the sitemap is dynamically generated, also check that it isn't accidentally gated behind authentication, a maintenance-mode redirect, or a bot-blocking rule meant for scrapers that's catching Googlebot too.

Keeping it accurate over time

A sitemap degrades quietly. Pages get deleted without being removed from the file, canonical tags change without the sitemap being regenerated, and lastmod dates get bumped on every deploy regardless of whether content actually changed. That last one specifically trains Google to stop trusting your lastmod signal, so only update it when the page's substantive content changes.

Regenerate the sitemap on a schedule tied to content changes, not on a fixed timer disconnected from reality, and periodically diff the sitemap's URL count against your CMS's actual published-page count. A gap between the two numbers is usually the first sign something's misconfigured.

Key takeaways

  • A sitemap is a discovery and crawl-scheduling hint, not a ranking factor and not a guarantee of indexing.
  • WordPress SEO plugins generate sitemaps automatically; the real work is auditing what's excluded, not building the file.
  • Only include canonical, indexable, 200-status URLs, redirects, 404s and noindexed pages waste crawl attention.
  • 'Submitted URL not indexed' is a content or link-signal problem; resubmitting the sitemap won't fix it.
  • 'Submitted URL marked noindex' means the sitemap and the page's own directive disagree, check meta robots and the X-Robots-Tag header, not just the visible HTML.
  • A sitemap that Search Console can't fetch or parse is usually a robots.txt block, a malformed XML file, or a soft-404 masquerading as a 200.
Questions

XML Sitemaps Explained, FAQ

Does adding a page to my sitemap make it rank better?+

No. A sitemap is a discovery hint, not a ranking signal, Google says this directly. It can help Google find and crawl a page faster, but ranking depends on the page's content, links, and overall quality, none of which the sitemap affects.

Do I need an XML sitemap for a small site?+

Usually not critically. Sitemaps matter most on large sites, new sites with few inbound links, and sites with weak internal linking where crawlers might miss pages otherwise. A small, well-linked site will typically get fully crawled without one, though submitting one costs little and doesn't hurt.

Why does Search Console say 'Submitted URL not indexed'?+

Google saw the URL in your sitemap but decided not to store it in the index, usually because of thin or duplicate content, weak internal linking to the page, or a quality assessment against similar pages already indexed. Use URL Inspection on the specific URL for the exact reason. Resubmitting the sitemap doesn't fix this; the page or its signals need to change.

What does 'Submitted URL marked noindex' mean?+

The page in your sitemap carries a noindex directive, either a meta robots tag in the HTML or an X-Robots-Tag HTTP header, and Google is obeying it. Check both, the header is invisible in page source and often set at the server or CDN level. This is commonly a staging-environment setting that leaked into production.

Why can't Search Console fetch my sitemap?+

Check, in order: that the sitemap URL returns a real 200 status and not a soft-404, that the XML is well-formed, that robots.txt isn't blocking the sitemap's own path, that the content type is correct, and that the file is under the 50,000-URL/50MB limit. Any one of these will produce a fetch or format error.

How often should I update lastmod dates?+

Only when the page's actual content changes. Bumping lastmod on every deploy regardless of whether anything meaningful changed trains search engines to stop trusting the signal, which defeats its purpose of helping Google prioritize re-crawling.

Related guides

← All guides

Sources & data note

This guide describes documented, widely-accepted practice as published by Google Search Central and Google Search Console Help, which are cited above. Plugin behavior (Yoast, Rank Math, All in One SEO) reflects each plugin's documented defaults at time of writing and can change with updates; verify current settings in the plugin itself. Search engine crawler and error-message behavior changes over time: treat specific interface labels and thresholds as current guidance and verify against the official documentation before relying on them. Guides are written from primary sources, Nepali government departments, operators, park authorities and standards bodies, and each guide lists the sources used for its own facts. Rules, fees and prices in Nepal change; treat figures as current at the review date shown on each guide and verify anything money- or visa-critical with the issuing authority before you rely on it.