Home›SEO QA›Canonical Testing

SEO QA · Consolidation

Canonical Testing

Canonical tags are generated by code, so they change when code changes. Test the pattern per template and diff the value every release.

8 test cases5 template patternsDiff detection

SEO QA · Verification process

Canonical testing verifies that each page declares the right preferred URL and that the declaration stays stable through template, routing and configuration changes. Canonical defects are silent: the page looks identical to visitors while ranking signals consolidate to another URL.

Definition

A canonical test checks the value on each URL against a rule for its template, then checks that the target is a 200, indexable URL. A canonical diff compares the value with the previous crawl and flags every change not listed in a ticket. For what canonicals do, see the Academy lesson on canonicals. For fixing existing issues, see canonical tag issues.

Test cases

Test casePassFail
PresentOne tag on every indexable templateMissing
Absolute and validFull URL, correct protocol and hostRelative, malformed, wrong host
Single sourceOne canonical across HTML and Link headerTwo tags, or HTML and header disagree
Follows template ruleMatches the pattern belowDifferent pattern
Target statusTarget returns 200Target redirects or errors
Target indexableNo noindex, not blockedTarget excluded from indexing
StableSame value as the last crawlChanged without a ticket
Consistent within templateEvery URL of a template follows one patternPattern varies

Expected pattern per template

TemplateExpected canonicalCommon release defect
Product or articleSelfPoints to parent category after a breadcrumb refactor
Paginated listingSelf per pageAll pages point to page 1
Filtered or sorted listingUnfiltered listing, if that is the site policySelf canonical, creating many indexable variants
Tracking parameter URLClean URLParameter kept in canonical
Localized pageSelf, with hreflang to alternatesPoints to default language

Write the pattern for each template down as an acceptance criterion, so the test has a fixed expected value.

When to test

  • Updates to head components, SEO plugins or meta frameworks
  • Changes to base URL or environment configuration
  • Pagination, filter or parameter handling changes
  • Trailing slash or URL casing rule changes
  • Domain moves, where every canonical host must change

Pre and post-deployment workflow

Diffing one field across two crawls exposes template-wide changes in seconds. Audit comparison lists every URL whose canonical moved. Canonicals sent in the HTTP Link header need the header test in HTTP header SEO testing.

Before and after example

Before deployment/shoes/?page=2 → canonical /shoes/?page=2
/shoes/?page=3 → canonical /shoes/?page=3
→
After deployment/shoes/?page=2 → canonical /shoes/
/shoes/?page=3 → canonical /shoes/
Verdict: regression. Pagination refactor stripped the page parameter, hiding products on deeper pages.