question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SEO - Document doesn't have a valid hreflang

See original GitHub issue

Provide the steps to reproduce

  1. Go to https://lighthouse-dot-webdotdevsite.appspot.com//lh/html?url=https%3A%2F%2Fnrn-v2-mst-aptd-at-lcz-sty-c1-mgu1yndpx-unly-oss.vercel.app%2Fen%3FnoAutoPreviewMode%3Dtrue

What is the current behavior?

SEO error with Document doesn't have a valid hreflang but there are only 3 and all seem to follow the spec.

image

What is the expected behavior?

I checked several times and even read https://hreflang.org/what-is-a-valid-hreflang/ and can’t figure out what’s wrong. The error is too wide to be actionable.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
patrickhulcecommented, May 10, 2021

The SEO category is not just for what can work according to HTML spec, but about SEO best practices. I find that Stack Overflow answer rather misleading as the source article is specifically calling out the use of relative href as a common source of mistakes, not saying it should be used.

The official search documentation on this subject specifically recommends use of absolute URLs for all hreflang alternates.

Alternate URLs must be fully-qualified, including the transport method (http/https), so: https://example.com/foo, not //example.com/foo or /foo

Until told otherwise by search, that’s what the audit will respect.

1reaction
connorjclarkcommented, May 10, 2021

The error is below each item: “Relative href value”. You need to use absolute URLs.

Why do we check that in this audit? I’m not sure. Does anyone know?

Our docs don’t mention it either. https://web.dev/hreflang/

The string could be better.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Document doesn't have a valid hreflang - Chrome Developers
Document doesn't have a valid hreflang ... Many sites provide different versions of a page based on a user's language or region. hreflang...
Read more >
How do you fix the "your site has no hreflang tags" issue?
Troubleshooting the “your site has no hreflang tags” error · Check bidirectional links. · Update your implementation when a page is deleted. ·...
Read more >
[SEO Audits] Document has a valid hreflang code · Issue #3177
Success condition: Query selector head > link[rel=alternate][hreflang] doesn't exist, or the hreflang value passes aXe validation for each ...
Read more >
Hreflang: The Easy Guide for Beginners - Ahrefs
Learn what hreflang tags are, when you should use them, how to implement them, and how to keep your website free of common...
Read more >
hreflang: the ultimate guide • Yoast
This guide discusses what hreflang is, what it is for and gives in-depth information on how to implement it for your multilingual websites....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found