Which URLs belong in an XML sitemap
It should only list pages you want to appear in search results. Each one should load normally, be the canonical version of itself, and be open to indexing.
That rules out a few entries that often sneak in. A URL that redirects should be swapped for the page it redirects to. A page marked noindex, such as a basket or a thank-you page, shouldn't be listed at all. Broken pages and duplicates come out too. A clean list gives search engines a clear picture of what matters on your site.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://example.co.uk/services/</loc><lastmod>2026-10-02</lastmod></url>01<url><loc>https://example.co.uk/guides/oak-care/</loc><lastmod>2026-09-14</lastmod></url>02<url><loc>https://example.co.uk/old-offers/</loc></url>03<url><loc>https://example.co.uk/basket/</loc></url>04</urlset>
- 01/services/Canonical and indexable, so it stays
- 02/guides/oak-care/lastmod changed when the guide was rewritten
- 03/old-offers/Redirects with a 301, so it comes out
- 04/basket/Marked noindex, so it comes out
Lastmod dates and sitemap index files
The <lastmod> date tells search engines when a page last changed. Google says it uses the date when it's consistently accurate, so it's worth updating it only when the content really changes. Changing every date every day, with nothing new on the pages, can lead search engines to ignore the dates altogether.
Large sites often split their sitemap into several files, listed in a sitemap index. A shop might keep products, categories, and guides in separate files, which also makes problems easier to spot in Search Console.
How the XML sitemap on our new site is built
Our new website writes its XML sitemap from its own list of pages each time it's published.
Our site settings export const NOINDEX_PATHS = [MEET_PATH];export const isNoindexed = (path = "") => NOINDEX_PATHS.some((pattern) => pattern.test(path));One list of pages to keep outThe pages we want kept out of search are named in one place. For now that's only the meeting booking pages under our contact page, which are kept out of search on purpose.
Our sitemap script .filter(([id, path]) => path && isIndexable(id, path, market))const entry = (page) => ({ loc: site + page.path, lastmod: pageDate(page.path)?.at || "", images: images.get(page.path) });Everything else goes in, with its real dateEvery other page goes in, in a sitemap for its kind of page, all listed in one sitemap index. Its lastmod is when that page's own content last changed, the same as the Last updated line at the foot of the page, and its own pictures go in with it.
What an XML sitemap won't do
Submitting a sitemap helps search engines discover your pages. It doesn't guarantee they'll be crawled, indexed, or ranked. Pages still need internal links from the rest of the site, as a page that only appears in the sitemap can look unimportant. Once you submit a sitemap in Search Console, it reports how many of the listed URLs are indexed, and why the others aren't.

