Sub topic 12
Canonical URLs, Sitemap, and Crawlability
This chapter assumes you can read basic HTML and know how a URL maps to a page on a host. It also assumes you have a newsroom with release pages, as built in earlier chapters. The goal here is to help search engines find every release, pick the right URL for each one, and avoid indexing duplicates.
Why discoverability needs three tools
Search engines work in stages. A crawler fetches a URL, the indexer decides what the page is about, and the ranking system decides when to show it. Each stage can go wrong for a newsroom:
- The crawler may never find a new release if nothing links to it.
- The indexer may see the same release at several URLs and treat them as competing copies.
- A rule meant to protect private files may block pages you want found.
Three tools address these problems. A canonical URL names the preferred address of a page. A sitemap lists the pages you want crawled. Crawl rules (robots.txt and robots meta tags) say what crawlers may fetch or index.
Canonical URLs
A canonical URL is the one address you declare as the main version of a page. You declare it in the page head:
<link rel="canonical" href="https://example.com/newsroom/acme-launches-widget-2">The same release can often be reached at several addresses:
http://andhttps://versions- With and without
www - With and without a trailing slash
- With tracking parameters, such as
?utm_source=newsletter - Through a category listing, such as
/newsroom/category/products/acme-launches-widget-2
Without a canonical signal, a search engine picks one itself. It may pick a version you did not intend, and links and shares may be split across variants.
Rules for writing canonical links
- Use an absolute URL with the scheme and host. Relative canonicals are allowed but easy to get wrong.
- Put the tag in the
<head>. A canonical placed in the body is ignored. - Make each release canonical to itself. A self-referencing canonical protects you when someone appends a parameter to the URL.
- Use one canonical per page. Two conflicting tags cause search engines to ignore both.
- Point only to a page that returns a 200 status and is indexable. A canonical pointing to a redirect or a page marked
noindexsends mixed signals. - Keep the canonical consistent with other signals: the
og:urltag, the sitemap entry, the RSSguid, and theurlin your structured data should all use the same address.
Treat the canonical as a strong hint, not a command. Search engines may override it when other signals, such as redirects or internal links, disagree.
Redirects versus canonicals
Both consolidate duplicates, but they work differently.
| Situation | Use | Reason |
|---|---|---|
| `http` should never be served | 301 redirect to `https` | Visitors and crawlers both end up at one address |
| `www` and non-`www` both resolve | 301 redirect to the chosen host | Same reason |
| A release appears in two category listings | Canonical to the release's main URL | Both URLs must stay reachable |
| Tracking parameters on shared links | Self-referencing canonical | You cannot redirect every parameter |
| A release moved to a new path | 301 redirect from old to new | Old links and bookmarks keep working |
A good rule: redirect when the old address should stop existing, and use a canonical when both addresses must keep working.
Stable URLs for releases
A canonical is only useful if the URL itself does not change. Choose a pattern early, such as /newsroom/<slug>, where the slug is a short, lowercase, hyphenated summary of the title. Avoid dates or database IDs in the path unless you need them. If you do change a slug later, add a 301 redirect from the old address and update the sitemap, RSS feed, and canonical tag.
The XML sitemap
A sitemap is an XML file that lists URLs you want crawled. It does not guarantee indexing. It helps crawlers find pages faster, especially new releases that have few inbound links.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/newsroom</loc>
<lastmod>2026-03-12</lastmod>
</url>
<url>
<loc>https://example.com/newsroom/acme-launches-widget-2</loc>
<lastmod>2026-03-12</lastmod>
</url>
</urlset>Each <url> entry needs a <loc>. The <lastmod> element is optional, but it is the most useful extra field. Search engines use it only if it proves accurate over time, so set it to the date the page content last meaningfully changed, not the date your build ran. Google has said it ignores <priority> and <changefreq>, so you can leave them out.
Sitemap limits and structure
- A single sitemap file can hold up to 50,000 URLs and must be no larger than 50 MB uncompressed.
- Every URL must use the same scheme and host as the sitemap's location, and must be absolute.
- Use UTF-8 and escape special characters. An ampersand in a URL becomes
&. - Include only canonical, indexable URLs that return 200. Leave out redirects,
noindexpages, and non-canonical variants.
A newsroom rarely reaches 50,000 URLs. If your site does, split the files and list them in a sitemap index:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-newsroom.xml</loc>
<lastmod>2026-03-12</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-pages.xml</loc>
<lastmod>2026-01-20</lastmod>
</sitemap>
</sitemapindex>A separate newsroom sitemap is useful even on small sites. It lets you see in a search console how many newsroom pages were submitted versus indexed.
Generating the sitemap automatically
A hand-edited sitemap goes stale. Generate it from the same source as your release list. This Python script reads a list of releases and writes a valid file:
from datetime import date
from xml.sax.saxutils import escape
BASE = "https://example.com"
releases = [
{"slug": "acme-launches-widget-2", "updated": date(2026, 3, 12)},
]
def build_sitemap(items):
lines = ['<?xml version="1.0" encoding="UTF-8"?>',
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">']
newest = max(r["updated"] for r in items)
entries = [(f"{BASE}/newsroom", newest)]
entries += [(f"{BASE}/newsroom/{r['slug']}", r["updated"]) for r in items]
for loc, mod in entries:
lines.append(" <url>")
lines.append(f" <loc>{escape(loc)}</loc>")
lines.append(f" <lastmod>{mod.isoformat()}</lastmod>")
lines.append(" </url>")
lines.append("</urlset>")
return "\n".join(lines) + "\n"
with open("sitemap-newsroom.xml", "w", encoding="utf-8") as f:
f.write(build_sitemap(releases))Run this as part of your publishing step so a new release and its sitemap entry go live together.
Telling crawlers where the sitemap is
There are two ways to announce the file:
- Add a
Sitemap:line torobots.txt. - Submit the URL in the webmaster tools of each search engine you care about, such as Google Search Console and Bing Webmaster Tools.
The robots.txt line works for every crawler that reads it:
User-agent: *
Disallow: /newsroom/embargoed/
Disallow: /newsroom/assets/raw/
Sitemap: https://example.com/sitemap-newsroom.xmlCrawlability
Crawlability is whether a bot can fetch your pages and follow links between them. Indexability is whether it is allowed to store them. They are controlled by different tools, and mixing them up is the most common error.
robots.txt controls crawling, not indexing
A Disallow rule stops compliant crawlers from fetching a path. It does not remove the URL from search results. If other sites link to a blocked URL, it can still appear in results with no description, because the crawler could not read the page.
To keep a page out of the index, allow crawling and add a robots meta tag:
<meta name="robots" content="noindex">If you block the page in robots.txt, the crawler never sees the noindex tag, so the tag does nothing. Pick one approach per page.
Also remember that robots.txt is public and advisory. Never use it to hide confidential material. Embargoed releases should sit behind authentication, not just a Disallow line, because the file itself tells everyone the path exists.
Common crawlability failures
| Problem | Symptom | Fix |
|---|---|---|
| Releases load only through JavaScript after a click | Listing shows few releases in search | Render links as real `<a href>` elements in the HTML |
| "Load more" button with no paginated URLs | Older releases never crawled | Provide `?page=2` style links or an archive page |
| Release not linked from anywhere | Page is an orphan; found only via sitemap | Link it from the newsroom index |
| `robots.txt` blocks CSS or JS | Rendered page looks broken to the crawler | Allow the files the page needs |
| Soft 404s (error text with a 200 status) | Missing pages stay in the index | Return a true 404 or 410 |
| Redirect chains | Slow crawling, lost signals | Redirect straight to the final URL |
| Assets blocked by a login wall | Images and PDFs are not found | Keep public assets public |
Internal linking
Sitemaps supplement links but do not replace them. Every release should be reachable from the newsroom index within a few clicks, and the index should link to an archive. Use descriptive link text: "Acme launches Widget 2" is better than "Read more". The newsroom page from earlier chapters already follows this by linking each <h3> title to its release.
Verifying your setup
Check each layer with simple tools.
- Fetch a release and confirm status and canonical:
curl -sI https://example.com/newsroom/acme-launches-widget-2 | head -n 1
curl -s https://example.com/newsroom/acme-launches-widget-2 | grep -i 'rel="canonical"'- Confirm that variants redirect to one address:
curl -sI http://www.example.com/newsroom | grep -iE '^(HTTP|location)'- Open the sitemap in a browser and confirm that it loads as XML and each URL returns 200.
- In Google Search Console, use the URL Inspection tool on a new release. It shows the canonical URL Google selected and whether the page is indexed.
- In the Sitemaps report, check that the submitted count matches the number of releases you expect.
Edge cases
- Syndicated releases. If a wire service republishes your release, ask them to add a canonical link pointing to your newsroom page. If they will not, expect their copy to rank and make your own page distinct, for example with a quote or data not on the wire version.
- Updated releases. Edit the page in place and update
lastmod. Do not publish a new URL for a correction. Note the correction on the page. - Press assets. Images and PDFs can have their own sitemap entries using the image extension, but linking them from an HTML page is usually enough.
- Pagination. Give each archive page its own self-referencing canonical. Pointing every page to page 1 hides older releases from the index.
- Staging sites. Block staging with authentication. If a staging copy is indexed, its canonical tags may point to the wrong host.
Exercise
A release is available at both /newsroom/acme-launches-widget-2 and /newsroom/category/products/acme-launches-widget-2. You also add Disallow: /newsroom/category/ to robots.txt and a canonical on the category URL pointing to the main one. Why might this not work as intended, and what should you change?
Show answer
The Disallow rule stops crawlers from fetching the category URL, so they never see the canonical tag on it. The duplicate can still show up in results if it is linked elsewhere. Remove the Disallow rule so the crawler can read the canonical tag, keep the canonical pointing to /newsroom/acme-launches-widget-2, and make sure only the main URL appears in the sitemap.
Exercise
Name three things that should be left out of a newsroom sitemap, and say why.
Show answer
Redirected URLs, pages marked noindex, and non-canonical variants such as parameter versions. The sitemap should list only canonical, indexable URLs that return 200, so that the file matches what you want in the index.