Pages with no canonical tag
What Is This Issue
This issue checks whether every crawlable HTML page includes exactly one valid canonical link element in the head section.
A canonical tag tells search engines which URL should be treated as the “official” version of a page when multiple URLs show similar or identical content. For this check to pass:
- The page must have exactly one canonical tag
- The canonical URL must be valid and parseable
- The canonical tag must be properly placed in the HTML head section
Example: If your page is accessible at both https://example.com/page and https://example.com/page?utm_source=newsletter, a canonical tag pointing to https://example.com/page tells search engines to consolidate ranking signals to that preferred URL.
Why Is This Important
Canonical tags are essential for:
- Indexability: They help search engines understand which URL should appear in search results
- Rankings: Canonicalization consolidates ranking signals (like links and engagement) to a single preferred URL
- Duplicate content: They prevent multiple URL variants from competing with each other in search results
When canonical tags are missing, duplicated, or malformed, search engines may:
- Choose an unintended URL as the canonical version
- Split ranking signals across multiple URL variants
- Create reporting inconsistencies in analytics and search console data
Resolving this issue improves your overall SEO health score by ensuring search engines can reliably identify and rank your preferred URLs.
How XeoPix Detects This
XeoPix follows these steps to identify canonical tag issues:
-
Fetches the page: XeoPix requests the URL and checks if the response is HTML content.
-
Extracts canonical tags: It parses the raw HTML and looks for all
<link>elements in the head section where therelattribute contains “canonical”. -
Counts and validates: XeoPix counts how many canonical tags are found and extracts the href values.
-
Checks for issues: The system flags problems when:
- No canonical tag is found
- Multiple canonical tags are present
- The canonical URL is empty or malformed
- The canonical URL cannot be parsed as a valid absolute URL
-
Reports findings: XeoPix records whether the page passes or fails the canonical check, along with details about what was found.
The detection relies only on the raw HTML response—no JavaScript execution or browser rendering is used.
How To Fix
-
Add a canonical tag to every indexable page: Ensure each HTML page includes one
<link rel="canonical" href="...">tag in the head section. -
Use absolute URLs: Always use complete URLs (e.g.,
https://example.com/page) rather than relative paths. -
Ensure uniqueness: Each page should have exactly one canonical tag—not zero, not multiple.
-
Make URLs valid: The canonical URL should be a properly formatted, parseable absolute URL.
-
Validate implementation: After deployment, crawl your pages to confirm canonical tags are present, unique, and point to valid URLs.
-
Keep it deterministic: Configure your templates or CMS to generate canonical tags consistently so exactly one tag appears per page.
What We Store
Storage Level
Page Level — This issue is evaluated for each individual URL.
Database Table / Prisma Model
PageSeoBasicsData
Stored Fields
| Field | Type | Description |
|---|---|---|
| canonicalUrl | String? | The canonical URL specified in the page |
Detection Dependencies
- The following data sources are required to evaluate this issue:
- HTML Document — The crawler extracts the
<link rel="canonical">tag from the HTML head - HTTP Headers — The crawler also checks for
Link: <url>; rel="canonical"in HTTP headers
Examples
Example 1: Correct canonical tag
Scenario: A page with a properly implemented canonical tag.
Passes because:
- Exactly one canonical tag is present
- The canonical URL is a valid absolute URL
- The tag is placed in the HTML head section
<head>
<link rel="canonical" href="https://example.com/blog/post" />
</head>Example 2: Missing canonical tag
Scenario: A page without any canonical tag.
Fails because:
- No canonical tag is present
- Search engines must guess the preferred URL
- Multiple URL variants may be indexed
<head>
<!-- No canonical tag -->
</head>Corrected version:
<head>
<link rel="canonical" href="https://example.com/blog/post" />
</head>Example 3: Multiple canonical tags
Scenario: A page with multiple canonical tags.
Fails because:
- Multiple canonical tags create confusion
- Search engines may not know which URL is preferred
- This is invalid HTML
<head>
<link rel="canonical" href="https://example.com/page1" />
<link rel="canonical" href="https://example.com/page2" />
</head>Corrected version:
<head>
<link rel="canonical" href="https://example.com/page1" />
</head>Unit Test
Test File
__tests__/seo-audit-checks/pageSeoBasics/issue-6-duplicate-title.test.js
Purpose
Validates that the SEO audit correctly detects pages with duplicate <title> tags while allowing pages with a single title tag to pass.
Tested Function
runPageSeoBasics() from toggleGroups/pageSeoBasics.js
Issue Information
- Issue Number: 6
- Issue Code:
NO_DUPLICATE_ELEMENTS(no_duplicate_elements) - Toggle Group:
pageSeoBasics
Test Scenarios
Positive Test Cases
- Single title tag — Page has exactly one
<title>tag in the<head>. No issue should be reported. - Empty head — Page has an empty
<head>section with no title tags. No issue should be reported.
Negative Test Cases
- Two duplicate title tags — Page has two
<title>tags. The issue should be reported withduplicateElementscontaining{ element: 'title', count: 2 }. - Three or more duplicate title tags — Page has three
<title>tags. The issue should be reported withcount: 3.
Boundary Cases
None.
Edge Cases
- Empty head — A page with no
<head>content should not trigger a false positive. - Three or more duplicates — Verifies the detection works for 3+ duplicate title tags, not just exactly 2.
Expected Outcome
Pass
The issue is not reported when the page has zero or one <title> tag.
Fail
The issue is reported when the page has two or more <title> tags.
Validation
- Verifies correct issue detection for duplicate title tags
- Verifies no issue is reported when there is a single title tag
- Verifies the
duplicateElementsarray contains the correctelementandcountvalues - Verifies detection works for 2 and 3+ duplicate tags
- Verifies empty head does not produce false positives
Related Production Files
toggleGroups/pageSeoBasics.jsissueCodes.jsutils/issues.js
Coverage Summary
- Covers single title tag (pass)
- Covers two duplicate title tags (fail)
- Covers three duplicate title tags (fail)
- Covers empty head (pass)
- Validates payload structure (
duplicateElementsarray)
References
- Consolidate duplicate URLs — Google Search Central
- Link Type canonical — WHATWG
- URI Generic Syntax — RFC 3986