# Include only indexable canonical URLs returning HTTP 200

- Check 03.07 · Crawling · Critical
- Source: https://checklist-seo-geo.com/en/crawling/include-only-indexable-canonical-urls-returning-http-200
- Set the sitemap's entry criteria (200, indexable, canonical), audit every URL with a script or Screaming Frog and filter at the source.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/crawling/include-only-indexable-canonical-urls-returning-http-200.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

A sitemap is not an inventory of every URL on the site: it is the list of those you want to see in search results. This check sets the entry criteria (200 response, indexable page, URL that is its own canonical, on the reference host and protocol) and applies them in the generator, so that the sitemap contains nothing else. Expected result: an audit in which every URL in the sitemap gets the “OK” verdict, and a generator that filters at the source rather than a list cleaned up by hand.

## Why it matters

Google puts it bluntly: list canonical URLs in the sitemap, the ones you want to see in search results, and not the duplicates that serve the same content. Every URL in a sitemap is a statement: “this page is the right version, index it”. When that statement contradicts the rest of the site, search engines have to decide:

- **A redirected URL** sends the crawler to another address: wasted crawling, and a muddled canonical signal.
- **A URL returning an error** (`404`, `410`, `5xx`) cannot be indexed; it clutters the reports.
- **A `noindex` URL** says both “index me” (sitemap) and “don't index me” (tag). The tag wins, but the inconsistency shows in Search Console.
- **A non-canonical URL** (sort parameter, `http` variant, page declaring another canonical) contradicts the `canonical` tag. Google treats inclusion in a sitemap as a canonicalization signal, weaker than a redirect or the tag: an inconsistent sitemap does not win the decision, it weakens it.

Bing pushes in the same direction: it relies on sitemaps and their `lastmod` to choose the pages to recrawl, which assumes a reliable list. For generative engines, the effect is indirect: Copilot and AI Overviews draw on indexes in which the right URLs are in place sooner and more reliably. No practice guarantees a citation.

The neighboring check, [Exclude redirects, errors and noindex pages](https://checklist-seo-geo.com/en/crawling/exclude-redirects-errors-noindex-pages), covers monitoring and cleanup over time. This one sets the entry rules and builds them into the generator.

## What it improves

- **Indexing**: search engines receive a list consistent with the canonicals, HTTP status codes and `robots` directives.
- **Crawling**: fewer requests wasted on redirects and errors, an effect felt mostly on large sites.
- **Diagnostics**: the indexing report filtered on submitted URLs shows only real problems.
- **Signal reliability**: a clean sitemap keeps its credibility, including for `lastmod`.
- **Rankings**: no direct effect.

## How to check

**1. With Google Search Console.** In the [Page indexing report](https://search.google.com/search-console/index), filter on “All submitted pages” (or on a specific sitemap): the remaining reasons for non-indexing, such as “Page with redirect”, “Not found (404)”, “Excluded by ‘noindex’ tag” or “Alternate page with proper canonical tag”, point to URLs that have no business being in the sitemap. The [Sitemaps report](https://search.google.com/search-console/sitemaps) lets you open this filter from each file.

**2. With Screaming Frog.** In `Configuration > Spider > Crawl`, tick crawling of linked XML sitemaps and enter their URL; run the crawl, then `Crawl Analysis > Start`. The Sitemaps tab offers the “Non-Indexable URLs in Sitemap” filter, whose indexability column gives the reason for each exclusion. The free version is limited to 500 URLs.

**3. Without a paid tool.** This script reads a sitemap or an index, then tests each URL: HTTP status without following redirects, `noindex` in the `X-Robots-Tag` header or the meta tag, declared canonical. Save it as `audit-sitemap.sh`:

```bash
#!/usr/bin/env bash
# Usage: ./audit-sitemap.sh https://example.com/sitemap.xml > audit.tsv

dossier=$(mktemp -d)

extraire_loc() {
  curl -s --compressed "$1" | tr -d '\r\n' | grep -o '<loc>[^<]*</loc>' \
    | sed -e 's/<loc>//' -e 's/<\/loc>//' -e 's/&amp;/\&/g' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
}

if curl -s --compressed "$1" | grep -q '<sitemapindex'; then
  sitemaps=$(extraire_loc "$1")
else
  sitemaps="$1"
fi

printf "url\tcode\tnoindex\tcanonical\tverdict\n"

for sitemap in $sitemaps; do
  for url in $(extraire_loc "$sitemap"); do
    code=$(curl -s -o "$dossier/page.html" -D "$dossier/entetes.txt" -w '%{http_code}' --compressed "$url")

    noindex="no"
    if grep -i '^x-robots-tag:' "$dossier/entetes.txt" | grep -qi 'noindex'; then
      noindex="yes"
    fi
    if grep -i -o -E '<meta[^>]+name=.robots.[^>]*>' "$dossier/page.html" | grep -qi 'noindex'; then
      noindex="yes"
    fi

    canonical=$(grep -i -o -E '<link[^>]+rel=.canonical.[^>]*>' "$dossier/page.html" | head -n 1 \
      | sed -E "s/.*href=[\"']([^\"']*)[\"'].*/\1/")

    verdict="OK"
    if [ "$code" != "200" ]; then
      verdict="remove: status $code"
    elif [ "$noindex" = "yes" ]; then
      verdict="remove: noindex"
    elif [ -n "$canonical" ] && [ "$canonical" != "$url" ]; then
      verdict="replace with the canonical"
    fi

    printf "%s\t%s\t%s\t%s\t%s\n" "$url" "$code" "$noindex" "$canonical" "$verdict"
  done
done

rm -rf "$dossier"
```

```bash
chmod +x audit-sitemap.sh
./audit-sitemap.sh https://example.com/sitemap_index.xml > audit.tsv
awk -F '\t' 'NR > 1 && $5 != "OK"' audit.tsv
```

Open `audit.tsv` in a spreadsheet. The script sends one request per URL: on a large site, run it on one sitemap at a time. It does not treat a relative canonical (`href="/page"`) as equivalent, does not read a canonical sent in the HTTP `Link` header and does not detect soft 404s: check these cases by hand or with a crawler.

## How to implement

### Before you start

**The entry criteria**, to be enforced by the generator:

| Criterion | Condition for entering the sitemap |
| --- | --- |
| HTTP status | direct `200`, no redirect |
| Indexability | no `noindex` meta tag, no `noindex` in `X-Robots-Tag`, no robots.txt block |
| Canonical | absent, or identical to the URL itself |
| Host and protocol | those of the reference version (`https://example.com`), with the same trailing slash convention as the site |
| Parameters | no tracking, sort or session parameter |
| Editorial status | published, public, with no password or restricted access |
| Languages | each real translation with its own canonical, never a translation pointing to the main language |

**The implementation principle**: filter at the source. The generator must read the same data as the template that outputs `noindex` or `canonical`. If a page gets `noindex` because its “indexable” field is false, the sitemap query must exclude on that same field. It is the only way to keep the two from drifting apart at the next change.

**Edge cases**, to decide once:

| Page type | Usual decision |
| --- | --- |
| Paginated pages (`/blog/page/2/`) | include them only if they are indexable and their own canonical; many sites do without them |
| Categories or filters chosen as landing pages | include them if they have a stable URL and a self-referencing canonical |
| Pages for long-term out-of-stock or discontinued products | remove as soon as the page redirects or returns `404` |
| Author, date and tag archives | exclude them if they are `noindex` |
| Thank-you, confirmation and account pages | always excluded |

Keep the sitemap, canonicals and internal links consistent: see [Align canonicals, sitemap and internal links](https://checklist-seo-geo.com/en/indexing-canonicalization/align-canonicals-sitemap-internal-links).

### WordPress

Versions: WordPress 5.5 to 7.1; Yoast SEO 20 to 28; Rank Math 1.0.

**Native sitemap.** It knows nothing about plugins' `noindex` settings. Exclude the affected content with the query filter:

```php
add_filter('wp_sitemaps_posts_query_args', function (array $args, string $postType): array {
    $excludedIds = get_posts([
        'post_type' => $postType,
        'fields' => 'ids',
        'posts_per_page' => -1,
        'meta_key' => '_exclure_du_sitemap',
        'meta_value' => '1',
    ]);

    $args['post__not_in'] = array_merge($args['post__not_in'] ?? [], $excludedIds);

    return $args;
}, 10, 2);
```

Adapt the meta key to the one that drives your `noindex`. Remove taxonomies with no value with the `wp_sitemaps_taxonomies` filter.

**Yoast SEO.** A post set to “Allow search engines to show this content in search results?: No” leaves the sitemap, as does an entire content type set that way. To exclude specific IDs:

```php
add_filter('wpseo_exclude_from_sitemap_by_post_ids', function (array $excluded): array {
    return array_merge($excluded, [12, 34]);
});
```

**Rank Math.** `noindex` content is removed from the sitemap; the setting for each content type in `Rank Math SEO > Sitemap Settings` also lets you exclude posts by ID.

In every case, check redirects created by a plugin (Redirection, Yoast Premium, Rank Math): a redirected page that is still published stays in the sitemap. Switch it to draft or delete it.

### Shopify

Versions: Shopify, all plans, November 2026.

Shopify's sitemap lists only the reference URL of each product (`/products/…`), not its variants under `/collections/…/products/…`. To remove a resource from the sitemap and add `noindex, nofollow` to it, create the `seo.hidden` metafield of integer type and give it the value `1`: in `Settings > Metafields and metaobjects`, add a definition with the `seo` namespace and the `hidden` key for products, collections, pages or blog posts, then fill it in on the resource. Then check the sitemap and the page's meta tag: merchant reports indicate behavior that varies by resource.

### PrestaShop

Versions: PrestaShop 8 and 9; Google sitemap module (`gsitemap`) 4.4, or 5.0 from PrestaShop 8.2.

In the “Google sitemap” module configuration, tick only indexable page types. Disabled products have no public URL; a disabled product with a redirect must disappear at the next generation: make sure the scheduled task runs. If you set pages to `noindex` with an SEO module, check that it also removes them from the sitemap, otherwise exclude them in the sitemap module.

### Magento

Versions: Magento Open Source and Adobe Commerce 2.4.7 to 2.4.9.

The sitemap includes categories, products and CMS pages according to the options in `Stores > Settings > Configuration > Catalog > XML Sitemap`. Disabled or “Not Visible Individually” products have no page of their own: check in the audit that they do not appear. After a URL overhaul or a change to URL keys, regenerate the sitemap so that it does not list the old redirected addresses.

### Drupal

Versions: Drupal 10.3 and later, Drupal 11; Simple XML Sitemap 4.x; Metatag 2.x.

With Simple XML Sitemap, inclusion is set per content type, then entity by entity in the edit form. If you manage `noindex` with the Metatag module, align the two settings: a `noindex` page must be unticked in the sitemap.

### Laravel

Versions: Laravel 11 to 13; spatie/laravel-sitemap 7.3 and 8.x.

Filter in the query that feeds the sitemap, with the same fields as the template:

```php
Post::query()
    ->where('is_published', true)
    ->where('is_indexable', true)
    ->whereNull('canonical_url')
    ->whereNull('redirect_to')
    ->orderBy('id')
    ->lazy()
    ->each(function (Post $post) use ($sitemap): void {
        $sitemap->add(
            Url::create(route('posts.show', $post))
                ->setLastModificationDate($post->content_updated_at)
        );
    });
```

When run from the command line, `route()` builds the URL from `APP_URL`: check that it is set to the canonical host and protocol in production. The complete command is presented in [Generate the XML sitemap automatically](https://checklist-seo-geo.com/en/crawling/generate-xml-sitemap-automatically).

### Next.js

Versions: Next.js 15 and 16 (App Router).

Same principle in `app/sitemap.ts`: only request published, indexable content from the CMS, and build the URL with the same function as the page's canonical tag.

```ts
// app/sitemap.ts
import type { MetadataRoute } from 'next'
import { canonicalUrl } from '@/lib/seo'

type Article = { slug: string; updatedAt: string; noindex: boolean; canonical: string | null }

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
  const response = await fetch('https://cms.example.com/api/articles?status=published', {
    next: { revalidate: 3600 },
  })
  const articles: Article[] = await response.json()

  return articles
    .filter((article) => !article.noindex && article.canonical === null)
    .map((article) => ({
      url: canonicalUrl(`/blog/${article.slug}`),
      lastModified: article.updatedAt,
    }))
}
```

`canonicalUrl` is your function shared with `generateMetadata`: a single source for the canonical and the sitemap.

## Common mistakes

- **Listing every URL in the database**: drafts, private content, redirected pages and duplicates end up in the sitemap.
- **A sitemap that ignores the `noindex`** set by a plugin or a template field: the two sources drift apart.
- **URLs with `http://` or `www`** when the canonical site uses `https://` without `www`.
- **Inconsistent trailing slashes**: `/page` in the sitemap, `/page/` as the canonical, with a redirect between the two.
- **Tracking parameters** (`?utm_source=`) copied from campaign links.
- **Cleaning the file by hand**: the fix disappears at the next generation. Fix the query.
- **Translations canonicalized to the main language** but listed in the sitemap: see [Do not canonicalize all translations to the main language](https://checklist-seo-geo.com/en/multilingual-indexing-sitemaps/do-not-canonicalize-all-translations-main-language).

## Frequently asked questions

### Which URLs should go in an XML sitemap?

Put in the sitemap only the URLs you want to see in search results: pages that return 200 without a redirect, with no noindex tag, not blocked by robots.txt, and whose canonical is the URL itself. Use the reference host and protocol, with no tracking or sort parameter. Account, cart and confirmation pages and duplicates do not belong there.

### Can a noindex page stay in the sitemap?

No, a noindex page should not be in the sitemap. The sitemap tells search engines to index the page, and the tag tells them the opposite: the tag wins, but the inconsistency shows up in the indexing report and weakens trust in the file. Have the generator read the same field as the one that produces the noindex, so that the two stay aligned automatically.

### What happens if my sitemap contains redirects?

A redirected URL in the sitemap is not indexed under that address: the crawler follows the redirect and indexes the destination, if it sees fit. The cost is wasted crawling and a contradictory canonicalization signal. Replace the old address with the final URL, which must return 200. After a migration, regenerate the sitemap so that it contains only the new URLs.

### Is the sitemap enough to choose a page's canonical URL?

No, inclusion in a sitemap is a weaker canonicalization signal than a redirect or a canonical tag. Google may pick another URL if the signals contradict each other. The sitemap only reinforces the choice if it matches the canonical tag, the redirects and the internal links: align all three so that the declared URL is also the one Google selects.

## Resources

- [Google: Build and submit a sitemap](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap)
- [Google: Specify a canonical URL (consolidate duplicate URLs)](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls)
- [Google: Page indexing report](https://support.google.com/webmasters/answer/7440203)
- [Bing: Keeping content discoverable with sitemaps in AI-powered search](https://blogs.bing.com/webmaster/July-2025/Keeping-Content-Discoverable-with-Sitemaps-in-AI-Powered-Search)
- [Screaming Frog: Non-indexable URLs in sitemap](https://www.screamingfrog.co.uk/seo-spider/issues/sitemaps/non-indexable-urls-in-sitemap/)
- [WordPress: wp_sitemaps_posts_query_args filter](https://developer.wordpress.org/reference/hooks/wp_sitemaps_posts_query_args/)
- [Yoast: XML sitemaps API](https://developer.yoast.com/features/xml-sitemaps/api/)
- [Shopify: the seo.hidden metafield](https://shopify.dev/docs/apps/build/marketing-analytics/optimize-storefront-seo)

Next steps: [Exclude redirects, errors and noindex pages](https://checklist-seo-geo.com/en/crawling/exclude-redirects-errors-noindex-pages), [Provide a reliable lastmod](https://checklist-seo-geo.com/en/crawling/provide-reliable-lastmod) and [Align canonicals, sitemap and internal links](https://checklist-seo-geo.com/en/indexing-canonicalization/align-canonicals-sitemap-internal-links).
