Skip to content

Lesson 3 of 9 · 21m

Sitemaps, noindex, and Index Control

XML sitemaps are a discovery hint, index directives are page-level truth, and contradictions between them are a silent leak.

A sitemap is not a contract that forces Google to index anything. It is closer to a well-maintained inventory list handed to a busy warehouse worker. If the list contains items that are missing, restricted, duplicated, or mislabeled, the worker trusts the next list less. That is why sitemap hygiene matters even though sitemaps are only hints.

Build sitemaps from canonical URLs

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://sudosecurity.org/learn/seo-for-developers</loc>
    <lastmod>2026-11-29</lastmod>
  </url>
</urlset>

Every <loc> should be a final, indexable, canonical URL: 200 response, not redirected, not blocked, not noindex, and matching the page's canonical tag. Skip changefreq and priority fantasies; they are mostly ignored. lastmod is useful only when it honestly changes when the page content changes.

Large sites should use a sitemap index and split by type or section. The 50,000 URL / 50MB limits are real, but the operational reason to split is debugging: Search Console reporting is far more useful when /sitemap-posts.xml and /sitemap-courses.xml can be inspected separately.

Index directives need one source of truth

The indexable or not-indexable decision can be expressed in several places:

<meta name="robots" content="noindex,follow">
X-Robots-Tag: noindex

The HTTP header is especially useful for PDFs, images, or generated files where editing HTML is impossible. Meta tags are easier for templates. Pick the layer appropriate to the resource and make sure templates, edge rules, and CMS plugins are not fighting each other.

Common contradictions and what they mean

  • Sitemap URL returns 301: the sitemap is stale.
  • Sitemap URL has noindex: you asked for discovery of something you refuse to index.
  • Canonical points elsewhere: the sitemap lists a duplicate, not the preferred URL.
  • robots.txt disallows the page: Google may never see the noindex.
  • Pagination pages canonical to page one: deep inventory disappears from indexing consideration.

These contradictions rarely produce a dramatic error message. They produce slow non-performance: pages stuck in "Discovered — currently not indexed" or "Crawled — currently not indexed" while everyone argues about content quality.

Automate validation, not just generation

A deployment smoke test should fetch the sitemap, sample URLs, and compare what the sitemap claims against what the server returns.

curl -s https://sudosecurity.org/sitemap.xml | head
curl -sI https://sudosecurity.org/learn | grep -iE 'HTTP/|x-robots-tag'

The correct mindset is inventory reconciliation. If the sitemap says the page matters, the server response, canonical, robots rules, and internal links should all agree.

Field notes

  • Do not list URLs with tracking parameters in sitemaps; they teach search engines duplicate paths.
  • noindex is eventually obeyed only after the page is crawled, so removal is not instant.
  • A URL can be crawlable, canonical, high quality, and still not indexed because the site has stronger alternatives — indexation is selective.
  • Keep sitemap generation close to the database of record, not scraped HTML. Scraping your own site recreates your bugs in XML.

Was this lesson helpful?

Sign in to rate