Issue #168 · important
Issue 168
What is this issue?
Hreflang Self-Referencing Tag (Each Page References Itself)
This issue checks whether every page that participates in an hreflang cluster includes a self-referencing hreflang tag pointing to its own URL. Google requires this for the hreflang set to be considered complete and valid.
What This Issue Checks
The audit verifies that each page in a hreflang cluster includes a hreflang tag whose href attribute points back to the page itself. This signals to Google that the page is aware of its own place in the internationalized cluster.
What is Considered a Passing Implementation
Your website passes this check when:
- Every language variant page includes a self-referencing hreflang tag
- The self-referencing href points to the page's own canonical URL
- The self-referencing href is a fully qualified absolute URL (including scheme and host)
- The URL scheme of the self-referencing href matches the crawled page URL scheme (both https or both http)
- The self-referencing tag uses a valid ISO 639-1 language code
Real-World Example
Passing Implementation:
<!-- On the English page: https://example.com/en/ -->
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/" />
Failing Implementation:
<!-- On the English page: https://example.com/en/ -->
<!-- Missing self-referencing tag for en -->
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/" />
Why does it matter?
Impact on SEO
Crawlability
Self-referencing hreflang tags help search engines understand the structure of your hreflang clusters. Without them, search engines may not properly crawl and understand the relationship between language variants.
Indexability
Google's hreflang specification requires that every page in a hreflang cluster include a self-referencing hreflang tag. Without it, Google may treat the hreflang cluster as incomplete and may not index the page as part of the international cluster.
Rankings
When pages properly self-reference in hreflang clusters, search engines can correctly serve the appropriate language version to users in different regions. This improves international ranking signals and ensures users see the correct language in search results.
User Experience
Proper hreflang self-referencing ensures that users are directed to the correct language version of your content. Without it, users may land on incorrect language pages, leading to poor user experience and higher bounce rates.
Duplicate Content
Self-referencing hreflang tags help search engines understand that pages in different languages are alternate versions of each other, not duplicate content. This prevents duplicate content issues across language variants.
AI Search / AEO
As AI-powered search becomes more prevalent, properly structured self-referencing hreflang tags help AI understand your content's language targeting within the hreflang cluster, ensuring accurate representation in AI-generated answers across different languages.
How Resolving This Issue Improves SEO Health Score
Fixing hreflang self-referencing issues improves your overall SEO health score by:
- Ensuring complete hreflang cluster recognition by search engines
- Preventing hreflang clusters from being ignored due to missing self-references
- Improving international SEO signals for all language variants
- Reducing incorrect language version serving
- Strengthening the overall international SEO structure of your website
How to fix it
Practical Recommendations
1. Add Self-Referencing Hreflang Tag to Every Language Page
Every page that participates in a hreflang cluster must include a hreflang tag that points to itself.
Implementation:
<!-- On the English page (https://example.com/en/) -->
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<!-- On the French page (https://example.com/fr/) -->
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
2. Use the Exact Canonical URL
The self-referencing hreflang tag must point to the page's exact canonical URL:
- Include the correct scheme (
https://nothttp://) - Include the full domain
- Match the canonical URL exactly (trailing slashes, case sensitivity)
Correct:
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
Incorrect:
<link rel="alternate" hreflang="en" href="/en/" />
<link rel="alternate" hreflang="en" href="http://example.com/en/" />
<link rel="alternate" hreflang="en" href="https://example.com/en" />
<!-- Missing trailing slash if canonical uses trailing slash -->
3. Include All Alternate Tags on Every Page
Don't add hreflang tags only on the homepage. Every page in the cluster must include:
- Its own self-referencing tag
- All alternate language tags
Example for all pages:
<!-- On ALL pages (en, fr, es) -->
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/" />
4. Ensure URL Scheme Matches
The URL scheme in the self-referencing hreflang tag should match the scheme of the page being crawled:
- If the page is served over HTTPS, the self-referencing href should use
https:// - If the page is served over HTTP, the self-referencing href should use
http://
5. Use Valid Language Codes
Ensure the self-referencing hreflang tag uses a valid language code:
- ISO 639-1 language codes (e.g.,
en,fr,es) - ISO 639-1 + ISO 3166-1 for regional variants (e.g.,
en-US,fr-CA)
Priority Order
- First: Add missing self-referencing hreflang tags to all language variant pages
- Second: Ensure all self-referencing hrefs use absolute URLs with correct scheme
- Third: Verify self-referencing hrefs match the page's canonical URL exactly
- Fourth: Add complete hreflang clusters (all alternates) to every page
- Fifth: Validate language codes in self-referencing tags
Examples
Example 1: Missing Self-Referencing Hreflang Tag
Scenario
A website has English and French pages with hreflang tags, but the English page doesn't reference itself.
Problematic State (Fails)
<!-- On page: https://example.com/en/ -->
<!-- Missing self-referencing tag for en -->
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
Result: Google may treat the hreflang cluster as incomplete and ignore the hreflang declarations.
Corrected State (Passes)
<!-- On page: https://example.com/en/ -->
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
Result: Google recognizes the complete hreflang cluster and properly associates the language variants.
Example 2: Self-Referencing Hreflang Uses Relative URL
Scenario
Self-referencing tag exists but uses a relative URL instead of absolute URL.
Problematic State (Fails)
<!-- On page: https://example.com/en/ -->
<link rel="alternate" hreflang="en" href="/en/" />
<!-- Relative URL - not valid for hreflang -->
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
Result: Google requires all hreflang href values to be absolute URLs. The relative URL may be ignored.
Corrected State (Passes)
<!-- On page: https://example.com/en/ -->
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
Result: All hreflang hrefs are valid absolute URLs that Google can process.
Example 3: Self-Referencing Hreflang Scheme Mismatch
Scenario
Page is served over HTTPS but self-referencing hreflang uses HTTP.
Problematic State (Fails)
<!-- Page URL: https://example.com/en/ -->
<link rel="alternate" hreflang="en" href="http://example.com/en/" />
<!-- Scheme mismatch: page is https, but hreflang uses http -->
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
Result: The hreflang cluster may be treated as mismatched due to inconsistent URL schemes.
Corrected State (Passes)
<!-- Page URL: https://example.com/en/ -->
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
Result: All hreflang URLs use consistent HTTPS scheme, ensuring proper cluster recognition.
How PixyScan detects this
PixyScan checks whether every page that participates in an hreflang cluster includes a self-referencing hreflang tag pointing to its own URL, as required by Google.
Detection Process
PixyScan follows these logical steps to identify missing self-referencing hreflang tags:
1. Fetch the Page and Resolve URL
PixyScan issues an HTTP GET request to the target URL and captures the final resolved URL after any redirects. This becomes the canonical page URL for comparison.
2. Extract All Hreflang Tags
PixyScan parses the <head> section of the raw HTML to find all <link rel="alternate" hreflang="..."> tags and extracts their href attributes.
3. Normalize URLs for Comparison
PixyScan normalizes both the page's canonical URL and the hreflang href values:
- Adds trailing slash if missing (for consistency)
- Lowercases scheme and host
- Resolves relative URLs to absolute URLs
4. Check for Self-Reference
PixyScan compares each hreflang href value against the page's own canonical URL to determine if any hreflang tag points to the page itself.
5. Validate Self-Referencing Tag
If a self-referencing tag is found, PixyScan validates:
- Whether the href is a fully qualified absolute URL (includes scheme and host)
- Whether the URL scheme matches the crawled page URL scheme (https vs http)
- Whether the language code is a valid ISO 639-1 value
6. Count Hreflang Cluster Size
PixyScan counts the total number of hreflang alternate tags found on the page to check if there's only one tag (which would indicate an incomplete cluster).
When the Issue is Flagged
The issue is flagged when any of these conditions are met:
- Missing self-referencing tag: No hreflang tag's href matches the page's own canonical URL
- Only one hreflang tag: Only one hreflang tag exists on the page (needs at least self-reference + one alternate)
- Self-referencing href not absolute: The self-referencing hreflang href is not a fully qualified absolute URL
- Scheme mismatch: The self-referencing href uses a different scheme (http/https) than the crawled page
When the Issue Passes
The issue passes when:
- A self-referencing hreflang tag is present on the page
- The self-referencing href points to the page's canonical URL
- The self-referencing href is a fully qualified absolute URL
- The URL scheme matches the crawled page scheme
- The page has more than one hreflang tag (indicating a complete cluster)