meta/canonical Canonical URL SEO Rule
Ensure every page has a valid canonical URL to prevent duplicate content issues and consolidate link equity
What This Rule Checks
Validates the presence and correctness of rel=canonical links. Checks for absolute URLs, HTTPS protocol, non-localhost domains, multiple canonicals, and conflicts with noindex directives.
Why It Matters for SEO & GEO
Canonical URLs tell search engines which version of a page is the primary one. Without proper canonicalization, duplicate content can dilute rankings and waste crawl budget.
How to Fix
Add a self-referencing canonical URL to every page using an absolute HTTPS URL. Ensure only one canonical tag exists per page. Remove conflicting noindex directives when using canonicals.
Examples
Bad
<link rel="canonical" href="/about"> Good
<link rel="canonical" href="https://example.com/about"> How VibeLinter Checks Canonical URLs
VibeLinter’s meta/canonical rule performs these checks on every page:
- Existence — Reports an info-level issue when no canonical URL is found
- Multiple canonicals — Flags multiple
<link rel="canonical">tags as a warning - Empty href — Reports canonical tags missing the
hrefattribute - Absolute URL — Ensures the canonical URL is absolute, not relative
- HTTPS protocol — Flags canonical URLs using HTTP instead of HTTPS
- Non-localhost — Catches canonical URLs pointing to localhost or 127.0.0.1
- Self-referencing check — Notes when canonical points to a different page
- Noindex conflict — Errors when both noindex and canonical directives exist (conflicting signals)
Configuration
// vibelinter.config.cjs
module.exports = {
rules: {
'meta/canonical': {
enabled: true,
severity: 'warning'
}
}
}
SEO Impact
Proper canonical URL implementation affects:
- Duplicate content resolution — Tells search engines which page version to index
- Link equity consolidation — Combines ranking signals from duplicate pages
- Crawl budget optimization — Prevents search engines from crawling duplicate pages
- GEO (Generative Engine Optimization) — AI models rely on canonical URLs to determine the authoritative version of content, ensuring the correct page is cited in generated answers