XML Sitemap Optimization: Canonical URLs, Accurate Lastmod and Search Console Checks

XML Sitemap Optimization guide showing a web professional reviewing canonical URLs, lastmod updates, and sitemap checks on a laptop.

 

You submit your sitemap, Google Search Console says “Success”, and yet many pages are still not indexed. The sitemap was read, but it may not be doing what you hoped.

XML sitemap optimization means giving search engines a clean, accurate list of the pages you want found. This guide shows what a sitemap can and cannot do, which URLs belong in it, and how to check it in Search Console.

What an XML Sitemap Can and Cannot Do

An XML sitemap is a file that lists the URLs on your site. It helps search engines discover your important pages, and it can carry details such as the last modified date.

It has limits:

  • It does not guarantee crawling, indexing, rankings or inclusion in AI answers.
  • It is a hint, not a command. Search engines decide what to crawl and index.
  • It matters most for large sites, new sites and sites with weak internal links.

There are two main types of sitemaps. XML sitemaps are written for search engine crawlers. HTML sitemaps are pages that help visitors navigate. Use them for different jobs, and do not treat one as a replacement for the other.

Problem: Wrong URLs in the Sitemap

Sitemap URL comparison showing which pages to include and exclude, with canonical pages, noindex URLs, redirects, errors, and utility pages.

Many sitemaps list every URL the CMS can produce. That includes pages you never want in search results.

Solution: list only canonical, indexable URLs that return a normal 200 status. Include only pages with SEO value.

IncludeLeave out
Canonical pages that you want indexedPages with noindex tags
Key landing pages, services and articlesRedirected URLs and error pages
Pages that return a 200 statusNon-canonical URLs and duplicates
Absolute URLs on your preferred version of the siteParameter URLs, such as sorting and tracking links
Account pages, cart pages and other utility pages
Pages blocked by robots.txt

If a page is in the sitemap but nothing links to it, it is an orphan page. Add internal links to it as well. A sitemap alone is a weak signal for finding and valuing a page.

If you are moving URLs, keep your sitemap in step with the new addresses. Our SEO migration checklist covers the redirect side.

Problem: Invalid or Messy XML

A broken file can stop search engines from reading your sitemap.

Solution: use valid UTF-8 XML, which stands for Extensible Markup Language. Use absolute URLs and the standard namespace from www.sitemaps.org, schemas sitemap 0.9.

Here is an illustrative basic sitemap entry. The domain is an example only.

<?xml version=”1.0″ encoding=”UTF-8″?>

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

  <url>

    <loc>https://www.example.com/services/seo/</loc>

    <lastmod>2026-11-10</lastmod>

  </url>

</urlset>

Only loc is required for each URL. Escape special characters, and keep each entry on its own line so it is easy to check.

Problem: Dates That Mislead

Some scripts change the modified date every time a page is saved or the sitemap is rebuilt. Search engines learn to ignore dates that do not match real changes.

Solution: set lastmod only when the page changes in a significant way, such as new content, a price change or a corrected fact. Do not bump the date to force a recrawl. An inaccurate lastmod can mislead search engines, and it will not create a freshness boost.

Priority and Changefreq: Safe to Drop

Google ignores the priority and changefreq tags. You can leave them out, which keeps files smaller and simpler.

This is about how Google reads them. It is not a rule of the sitemap protocol, and other tools may still read them. Do not spend time tuning these values for Google.

Sitemap Limits and the Sitemap Index File

Each sitemap file can hold up to 50,000 URLs and must be no larger than 50MB uncompressed. Both limits apply together, so a file must stay within both.

When a site grows past these limits, split the sitemap files and list them in a sitemap index file. A sitemap index file points to individual sitemap files, not to pages. It can manage multiple sitemaps.

Splitting by content type, such as articles, products and service pages, is optional. It can make reporting easier because you can see each group in Search Console. It is not a ranking requirement.

Both setups work:

  • Static sitemap: a file you update by hand. This suits small sites that change rarely.
  • Dynamic sitemaps: files your CMS or plugin generates. They update automatically when pages are published or removed, so check that they follow the rules above.

Optional Sitemaps: News, Video, Image and Hreflang

Some sites need more than a basic sitemap. Treat these as optional.

  • Google News sitemap: for news publishers. It lists only articles published in the last two days.
  • Video sitemap: helps search engines find video content. A dedicated video sitemap is useful if you host many videos.
  • Image sitemap: helps search engines find important images.
  • Language versions: you can list hreflang alternates in a sitemap instead of the page header.

These do not replace structured data on the page. They also do not guarantee rich results.

Submission Versus Actual Indexing

Submitting a sitemap tells search engines where to look. It does not mean every URL will be indexed.

  • Add a Sitemap: line to robots.txt so crawlers can find the file. The line can sit anywhere in the file.
  • Submit the sitemap in Google Search Console, and in Bing Webmaster Tools if Bing matters to you.
  • Treat the sitemap report as a record of what was read, not as an indexing report.

To see real indexing status, use the page indexing report and the URL Inspection tool. For a wider review, read our technical SEO audit guide.

Search Console Troubleshooting Checklist

1. Search Console troubleshooting checklist covering sitemap read errors, noindex URLs, non canonical URLs, redirects, and final URL checks.

Check the Sitemaps report first. Then review the page indexing report for URLs from that sitemap.

Issue you may seeWhat to checkAction
Sitemap could not be readIs the URL correct and valid XML?Fix the file, then resubmit
Submitted URL has noindex tagIs the page meant to be indexed?Remove the tag or remove the URL from the sitemap
Submitted URL is not canonicalWhich URL is the canonical version?List the canonical URL instead
Submitted URL redirects or returns an errorDoes the URL return a 200 status?Replace it with the final URL or remove it
Pages discovered but not indexedAre the pages useful and linked internally?Improve the page and add internal links

Fix the cause, not the report. Changing the sitemap alone will not solve a page quality problem.

Illustrative example: a sitemap lists 400 URLs, and 80 have a redirect. The action is to replace those 80 URLs with their final destinations and resubmit. This is a made-up example to show the method.

If you are new to submitting content, our guide on how to submit a blog to Google is written in Roman Urdu.

Common Mistakes to Avoid

  • Listing URLs that are blocked by robots.txt or marked noindex.
  • Changing lastmod without a real update.
  • Treating a submitted sitemap as proof of indexing.
  • Mixing up XML and HTML sitemaps.
  • Using a plugin and a custom generator at the same time, which can create duplicate or conflicting sitemaps.

Frequently Asked Questions

Does a sitemap guarantee indexing?

No. A sitemap helps discovery. Google decides what to index.

Should I remove priority and changefreq?

You can. Google ignores them, so they add no value for Google.

What are the sitemap size limits?

Up to 50,000 URLs and 50MB uncompressed per file. Use a sitemap index file when you need more.

Do I need dynamic sitemaps?

Not always. A static sitemap works for a small site that rarely changes. Choose dynamic sitemaps when your content changes often.

Do I need an HTML sitemap too?

It is optional. An HTML sitemap helps visitors navigate, and it can add useful internal links.

Need Help Checking Your Sitemap?

If you want a second pair of eyes on your sitemap and Search Console reports, see our SEO services or contact us through the contact page.

Picture of Syed Abdul

Syed Abdul

As the Digital Marketing Director at SEOpakistan.com, I specialize in SEO-driven strategies that boost search rankings, drive organic traffic, and maximize customer acquisition. With expertise in technical SEO, content optimization, and multi-channel campaigns, I help businesses grow through data-driven insights and targeted outreach.