Blog
XML Sitemap: What Helps Indexing, and What Does Not
An XML sitemap lists the canonical URLs you want indexed. How lastmod helps, why priority and changefreq do not, and what a sitemap cannot fix.
Muhammad Zubair Akhtar
An XML sitemap is a file that lists the URLs you want a search engine to know about, with the date of the last significant change when you actually know that date. Google reads it as a discovery hint. Listing a URL does not put that URL in the index, and it does not outrank a page that was never listed. This page is what the file is for, which URLs belong in it, and which tags Google skips.
I am Zubair Akhtar, a senior software engineer in Lahore, Pakistan. I ship Laravel, WordPress, and Next.js, and the sitemap is part of the same pass as the canonical and the status code. That wider pass is the technical SEO checklist. If you want the live file compared with the URLs that should rank, that work sits under technical SEO services.
On 17 November 2026 I read Google's sitemap overview, updated 10 December 2025, Build and submit a sitemap, updated 8 July 2026, Manage your sitemaps with sitemap index files, updated 10 December 2025, and How to specify a canonical URL, updated 10 July 2026. I also read the 26 June 2023 post Sitemaps ping endpoint is going away. For WordPress I read the 5.5 sitemap announcement, the 6.5 note that added lastmod, and the developer reference for WP_Sitemaps, WP_Sitemaps_Posts, WP_Sitemaps_Taxonomies::get_url_list, WP_Sitemaps_Users, and wp_sitemaps_get_max_urls. Those reference pages list a last modified date of 20 August 2026. I have not run these snippets for this article.
Figure 1. The file helps discovery. An accurate lastmod can help Google schedule a recrawl. Indexing is not promised, and priority and changefreq are ignored.
What an XML sitemap is
Google's overview describes a sitemap as a file where you provide information about the pages, videos, and other files on your site, and the relationships between them. Search engines read it to crawl the site more efficiently. It says which pages and files you think are important, and it can say when a page was last updated and which alternate language versions exist.
The build page, updated 8 July 2026, says Google supports the formats in the sitemaps protocol and has no preference among them. The three it compares are an XML sitemap, an RSS, mRSS, or Atom 1.0 feed, and a text file with one URL per line.
| Format | What it can carry | The limit I care about |
|---|---|---|
| XML sitemap | URLs, lastmod, and extensions for images, video, news, and localized versions | The format this page is about |
| RSS, mRSS, Atom 1.0 | Recent URLs, and video details in mRSS | A CMS feed usually lists recent URLs, not the whole site |
| Text file | One absolute URL per line, nothing else | No lastmod, no images, no alternate languages |
A text file is enough when you only need to name HTML URLs. It cannot carry a last modification date. An RSS or Atom feed is often already generated, and the same page warns that it only provides information on recent URLs. I use XML when the list is the set of URLs that should be stored, not the latest ten posts.
The basic document on the build page is this:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/foo.html</loc>
<lastmod>2022-06-04</lastmod>
</url>
</urlset>
loc is the absolute URL. lastmod is optional, and it is the only optional tag on that example that Google says it can use. Tag values are entity escaped, so an ampersand in a query string is & in the file. The file is UTF-8. Google says the order of the URLs does not matter.
You can host the file anywhere on the host. Unless you submit it in Search Console, it affects only descendants of the directory it sits in. A file at the root can cover the host, which is where that page says to put it. A sitemap at https://example.com/blog/sitemap.xml does not, by that rule, cover https://example.com/services unless Search Console is how Google received it.
What an XML sitemap helps, and what it cannot do
The overview says a sitemap helps search engines discover URLs, and that it does not guarantee that all of the items will be crawled and indexed. In most cases, it says, the site will benefit from having one. Those two sentences are the whole sitemap XML SEO claim I am willing to make. The file is a list of candidates. It is not a ranking control, and the overview does not say that a listed URL outranks an unlisted one.
The same page says you might need a sitemap when the site is large and some pages are hard to reach by links, when the site is new and has few links from other sites, or when you want Google to use extra information about video, images, or news. It says you might not need one when the site is small, about 500 pages or fewer that you want in results, when those pages are linked from the home page, and when you do not need media or news results. It still says most sites benefit. A small site can publish one. This site does. The file is the same path list as the URLs that are allowed to return 200.
What the file cannot do is the part people skip:
- It does not force a crawl. Submitting it, the build page says, is a hint that does not guarantee Google will download the file or use it to crawl the URLs.
- It does not force indexing. A listed URL can stay out.
- It does not choose the canonical by itself. On the specify-a-canonical page, updated 10 July 2026, sitemap inclusion is a weak signal. A redirect and
rel="canonical"are strong. The page says not to name one URL in the sitemap and a different URL in the tag. How those signals stack is the canonical tag post. - It does not replace internal links. The overview says that if important pages are linked, Google can usually discover most of the site without a sitemap. A URL that exists only in the file is a URL your own templates do not stand behind.
- It does not remove a URL. Taking a path out of the file does not erase a URL Google already stored. The removal signal is on the response, which means the URL has to stay crawlable. That split is the robots.txt guide.
- It does not override
noindex. I leave anoindexURL out because the build page says to include the URLs you want in search results. AnoindexURL is one I do not want stored.
The technical SEO audit guide is where I compare the indexed URL export with the sitemap. URLs in the index that are not in the file, and URLs in the file that should not be stored, are both findings. The file is not the audit.
Which URLs belong in the sitemap
The build page says to include the URLs you want to see in Google's search results, and that those are the canonical URLs. If the same content answers at more than one address, list the one you prefer, not every address that reaches it. Google will try to crawl the URL exactly as written, so loc is absolute: scheme, host, and path. A root-relative path is the example that page says not to use.
I list a URL when all of these are true. It returns 200. It is the canonical, the same string as the tag and the internal links. It should be a search result. It is the production host, not a staging host, not the HTTP copy of an HTTPS page. The specify-a-canonical page says not to put the HTTP URL in the sitemap when the HTTPS URL is the one you want.
I leave a URL out when any of these are true:
| Response or role | In the sitemap? | What I do instead |
|---|---|---|
| 200, self-canonical, should be stored | Yes | One absolute loc |
| 301, 302, 307, or 308 | No | List the target if that target is the 200 you want. How I pick the status is the 301 vs 302 post |
| 404 | No | The URL is missing. It does not need a loc |
| 410 Gone | No | Keep it crawlable so Google can see the 410. Do not Disallow it |
noindex, including a page people should still open | No | Keep the 200 and the crawl. The tag is the signal |
| Duplicate: trailing slash, www, tracking query, print view, HTTP | No | One canonical. The canonical tag post is that choice |
Faceted filter, such as ?color= or ?sort= | No, unless that exact URL should rank | The ecommerce technical SEO post is where those combinations bury a product |
Figure 2. One canonical 200 per page. Redirects, missing URLs, noindex URLs, and copies stay out of the file.
Spam and hacked paths are the 410 row. On this site an unknown path is not on the index allowlist. The allowlist is the path list the sitemap is built from, so that path is not a loc. The response is 410 Gone, with X-Robots-Tag: noindex, and robots.txt does not block it. Google only learns the 410 by fetching the URL. Putting the junk path in the sitemap would ask for a crawl of a URL I do not want stored. Leaving it crawlable, and out of the file, is the setup in how I removed hacked spam URLs from Google.
A URL you delete from the site should leave the file in the same deploy as the 410 or the redirect. A sitemap that still advertises /old-product after the route is gone is a list of URLs you told Google you want in results, aimed at a response that says the opposite.
lastmod, priority, and changefreq
The build page says this in the notes under the XML example. Google ignores <priority> and <changefreq> values. Google uses the <lastmod> value if it is consistently and verifiably accurate, for example by comparing it with the last modification of the page.
The same paragraph says lastmod should be the date and time of the last significant update. An update to the main content, the structured data, or the links is generally significant. An update to the copyright date is not. The June 2023 post says the same thing in operational language: if the page changed seven years ago and lastmod says yesterday, Google eventually stops believing the dates on that site. It also says you can omit lastmod on pages where the software cannot tell when the content changed, such as a homepage or a category that only aggregates other pages. A wrong date is worse than a missing date.
I treat these as significant: the body changed, a canonical or a heading changed, internal links changed, or the structured data changed. Adding or fixing structured data is the kind of update that page names, and the markup itself is the schema markup guide. I do not treat these as significant: a deploy that did not change the page, a new year in the footer, a cache-bust on an unchanged stylesheet, or a writer opening the file and saving it.
changefreq overlaps lastmod, which is why the June 2023 post says Google does not use it. priority is a guess about how important a page is relative to other pages on the same site. That post says it generally does not match reality, and that Google does not use it. Setting every URL to 1.0 does nothing under the current docs. I do not spend time tuning either tag.
The value has to be a date format the protocol allows. Search Console reports a bad value after you submit the file. A date, or a date with a time and a timezone, is the shape in the examples. A locale string such as "17 November 2026" is not.
On this site the sitemap is generated in app/sitemap.ts from the index allowlist. For a blog post, lastmod is the date in the markdown file, at midnight UTC. Editing the body does not move that value unless the date in the file is edited too. For every other route, the generator uses the clock time when the function runs. A rebuild therefore stamps those URLs with a new lastmod even when the page did not change. That is the pattern the July 2026 note warns about. The generator also writes changefreq and priority. Google ignores both. I am describing the file the repository builds. I am not claiming Google treats this site's non-post lastmod as a content change.
Size limits and a sitemap index
The build page sets one limit for every format: a single sitemap is at most 50 MB uncompressed, or 50,000 URLs, whichever you hit first. Past either cap, you split the list into more than one sitemap. You can put those files in a sitemap index and submit the index. You can also submit the child files separately, which that page says is useful when you want Search Console to show each file on its own.
The large-sitemaps page, updated 10 December 2025, says a sitemap index uses the same namespace and the same rules. It needs sitemapindex, a sitemap entry per file, and a loc for that file. A lastmod on the index entry is optional and refers to when that child file changed, not when a page changed. An index may contain up to 50,000 loc tags. The child files have to be on the same site as the index, unless you are using the cross-site submission that page documents, and they have to sit in the same directory as the index or deeper.
Search Console, on that page, accepts up to 500 sitemap index files per site. That is a submission cap in Search Console. It is not the 50,000 cap on loc tags inside one index.
The example on that page is a two-file index, and the child files are gzip-compressed. The 50 MB cap is uncompressed, so a .gz file can be smaller on the wire than the document Google parses:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemap1.xml.gz</loc>
<lastmod>2024-08-15</lastmod>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap2.xml.gz</loc>
<lastmod>2022-06-05</lastmod>
</sitemap>
</sitemapindex>
A site that is under both caps does not need an index. One file at /sitemap.xml is easier to keep honest. Splitting a few dozen URLs across files does not make them more indexable. I split when a file would cross 50,000 URLs or 50 MB uncompressed, or when I want a separate Search Console row for a section that is generated differently from the rest.
How to submit a sitemap
The build page lists three ways that still work, and the June 2023 post retires a fourth.
Search Console's Sitemaps report is the one that shows when Googlebot fetched the file and which processing errors it found. The Search Console API can submit a sitemap as well. I use the report when I want to see the fetch. The API is the same submission for a deploy that should not depend on someone clicking the form.
robots.txt can carry the location. The line is an absolute URL, and the build page says you can repeat it. There is no limit, on that page, to how many sitemap lines the file may contain. Google finds the line the next time it crawls robots.txt:
Sitemap: https://example.com/sitemap.xml
The line is discovery. It does not force indexing, it does not cancel a 410, and it does not override noindex. Put it after the User-agent groups. A Sitemap line between two groups can glue those groups together, which the robots.txt guide covers. Check the live file after deploy so the value is not still http://localhost/sitemap.xml.
The unauthenticated ping endpoint is the method to stop using. The 26 June 2023 post says Google is deprecating it because most of those unauthenticated submissions were spam, that requests to the endpoint result in a 404, and that existing plugins which still call it do not harm Google Search. They also do nothing useful. You do not need to delete the call for safety. You do need another way for Google to hear about the file, which is robots.txt or Search Console. For an Atom or RSS feed, that page also names WebSub as a way to broadcast changes. I do not use WebSub for an XML URL list.
Cross-site submission is in the build page for the case where one host stores the sitemaps of several verified sites. Each site's robots.txt points at its own file, or you submit in Search Console after verifying every property in the file. I do not need that for a single host. The failure mode is a sitemap on host A that lists host B, submitted only by being linked from a page, and then applying only to descendants of its own directory.
WordPress sitemap XML
WordPress has shipped an XML sitemap since 5.5. The announcement on 22 July 2020 says the index is at /wp-sitemap.xml. That file lists the child sitemaps. The rewrite rules in WP_Sitemaps, as published on the reference I read, map /wp-sitemap.xml to the index, and map files such as /wp-sitemap-posts-post-1.xml to a provider, a subtype, and a page number.
Core registers providers for posts, taxonomies, and users. For posts, get_object_subtypes returns public post types, then removes attachments, then keeps types that pass is_post_type_viewable. The description on that method says this includes custom post types registered with public set to true, and that navigation-menu item types and similar types are excluded. get_posts_query_args asks for post_status of publish. It does not read a robots meta tag. A published post that an SEO plugin marks noindex can still be in this file unless that plugin removes the entry or turns the core sitemap off.
The query default is 2,000 URLs per child file. wp_sitemaps_get_max_urls documents that default and the wp_sitemaps_max_urls filter, which receives the object type (post, term, or user). Two thousand is under Google's 50,000. I would not filter it above 50,000. The function I read does not itself clamp the filtered number to the protocol cap.
lastmod was not in the 5.5 file. The 8 March 2024 developer note for WordPress 6.5 says it was added for individual posts and for the homepage. The current WP_Sitemaps_Posts::get_url_list sets lastmod from post_modified_gmt, formatted with wp_date( DATE_W3C, ... ), on each post. When the homepage is set to show the latest posts, the pages sitemap also adds the home URL, and the code comment calls the date an approximation: it loads the latest posts by publish date, sorts those by post_modified_gmt, and uses the first. It is not a stored "homepage edited at" field.
The taxonomy provider's get_url_list sets loc to the term link and does not set lastmod. The user provider sets loc to the author archive and does not set lastmod. Authors are users who have published posts. The user query drops the attachment and page post types before has_published_posts, and the comment in that method says author archives for attachments and pages are not supported. A site that noindexes author archives should not leave those URLs in this provider. The query does not check that.
Sitemaps are on when the site is public. sitemaps_enabled starts from the blog_public option, then passes it through the wp_sitemaps_enabled filter. "Discourage search engines from indexing this site" turns the option off, which turns the sitemap off. The filter can force either result. When the filter disables sitemaps, the docblock says the rewrite rules stay so the URL can return 404. render_sitemaps sets that 404. This is the one-line form from the 5.5 announcement:
add_filter( 'wp_sitemaps_enabled', '__return_false' );
Use that when something else should be the only sitemap. Two indexes, core at /wp-sitemap.xml and a plugin at another path, are two hints. They drift. One will list a URL the other marks noindex. I keep a single index and point robots.txt at that file. The technical SEO checklist says the same thing. I am not picking a generator here. Core is the one WordPress already runs. If a plugin owns the list, core goes off. If core owns the list, the plugin's file goes off.
WP_Sitemaps::init adds the robots_txt filter only when sitemaps are enabled. add_robots appends a Sitemap: line with the index URL when the site is public. That is the robots.txt WordPress generates. A static robots.txt in the web root is a different file. The server can return it without WordPress running that filter, so the core line is missing until you add it yourself. After a host move, confirm the line names the new origin. A sitemap that still lists the old host is a problem the WordPress migration guide is meant to catch before the old URLs are the ones Google fetches.
The WordPress sitemap XML file is allowed to be boring. Published public URLs, one canonical each, lastmod only where core actually has a modified time, and no second file beside it. Custom post types that should rank need to be public and viewable, or the filter wp_sitemaps_post_types has to add them. Types that should not rank need to be out of that list. That is WordPress development work when the theme or a plugin is registering the type, not a search setting.
How this site builds the file
This site is Next.js. app/sitemap.ts maps listIndexablePathnames() from the index policy. That list is the static pages, including /services/seo, plus every published file in content/blog. A markdown file becomes a URL when the filename is a lowercase slug, published is true, and the title, description, date, and body are present. Anything else is not a route and not a loc.
Unknown paths, including a blog slug with no file, are answered with 410 before a trailing-slash redirect can turn them into an ordinary redirect. The sitemap never receives those paths, because it iterates the allowlist and not the request log. I want the file and the status codes to describe the same set: 200 and listed, or 410 and absent.
app/robots.ts sets the sitemap to the site origin plus /sitemap.xml, and it disallows /_next/image while leaving /images/ allowed. The Sitemap line and the crawl rules are the same deploy. A sitemap URL that robots.txt blocked would be a file Google was told not to fetch.
A Laravel app should build the file from the routes that should rank, not from every row in a table. That is the same rule, in a different framework, and it sits under Laravel development when the sitemap is part of the application rather than a file someone uploaded once.
Mistakes I still see in the file
Every URL the database can emit. Tags, attachments, date archives, authors, feed variants, and facet combinations. The file gets large, and Google is asked to spend crawls on URLs you do not want stored. Cut it to the canonical 200s.
lastmod set to now. A plugin or a build stamps every URL with the deploy time. After a few deploys the date no longer matches the page, which is when the July 2026 page says Google stops being able to use it. Omit the tag, or set it from a real content change.
Priority as a ranking dial. Values from 0.1 to 1.0, homepage at 1.0, blog posts at 0.6. Google ignores the tag. The time is better spent on whether the loc should exist.
The old URL and the new URL. A redesign leaves /about-us and /about both listed, or HTTP and HTTPS, or the slash and the slash-free path. List the target that returns 200. Redirect the other one.
A sitemap for URLs you are trying to drop. Spam paths, expired landing pages, and noindex thank-you pages. Remove the loc. Keep the URL crawlable if the removal signal is a 410 or a noindex tag.
Two generators. Core and a plugin, or a plugin and a hand-written file, submitted as two sitemaps. Pick one. Point robots.txt and Search Console at that one.
A subdirectory file expected to cover the host. Without a Search Console submission, the build page limits the file to its descendants. Put it at the root, or submit it.
The ping URL in a deploy hook. The endpoint returns 404 and Google has said the call does nothing useful. Ship the file, name it in robots.txt, and use Search Console when you need to see the fetch.
FAQ
Does an XML sitemap make Google index a page?
No. The overview, updated 10 December 2025, says a sitemap helps discovery and does not guarantee that the items will be crawled and indexed. The build page calls submission a hint. A listed URL can stay out. A URL that is not listed can still be indexed if something links to it.
Does Google use priority and changefreq?
No. The build page, updated 8 July 2026, says Google ignores <priority> and <changefreq>. The 26 June 2023 post says the same, and it says changefreq overlaps lastmod while priority is too subjective to trust. I do not tune either one.
When does lastmod help indexing?
It helps Google schedule crawls of URLs it has already discovered, and only when the date is consistently accurate. The build page says Google may check it against the last modification of the page. A significant change is the main content, the structured data, or the links. A copyright-year change is not. A date you do not believe should be left out.
How big can one sitemap be?
50,000 URLs, or 50 MB uncompressed, per file. Above that, split the list and submit a sitemap index. An index can list up to 50,000 child sitemaps. WordPress core starts a new child file at 2,000 URLs, which is the default of wp_sitemaps_get_max_urls, still under the protocol cap.
Where is the WordPress sitemap XML file?
On a public site that has not disabled the feature, the index is /wp-sitemap.xml. Child files look like /wp-sitemap-posts-post-1.xml. lastmod on posts comes from post_modified_gmt since WordPress 6.5. Term archives and author archives in the providers I read do not set lastmod. If a plugin publishes a different sitemap, turn core off with wp_sitemaps_enabled so only one index is live.
Should a 410 URL be in the sitemap?
No. A 410 is a URL you do not want in results. Leave it out of the file, and do not Disallow it, because Google has to fetch the response to see the 410. This site does that for unknown paths: 410, noindex header, and no loc.
Work with me
I read the sitemap against the URLs that return 200 and the URLs that should not exist. The usual findings are a lastmod that moves on every deploy, a second WordPress file beside /wp-sitemap.xml, and a loc for a redirect or a 410. That pass is technical SEO services. The written form, with the indexed URLs that are not in the file, is the technical SEO audit guide.
Send the live sitemap URL and one URL you expected to be listed that is not, or one URL that is listed and should be gone. I will start with the status code and the canonical, then the loc.
