Skip to content

Rule · SEO

hreflang uses invalid codes or relative URLs

seo/hreflang-invaliderrorvoid seoupdated

Why it matters

Google ignores hreflang annotations with invalid language/region codes (en_US, region-only) or non-absolute URLs.

How to fix it

Use ISO 639-1 language with optional ISO 3166-1 region (en, en-GB) or x-default, with absolute URLs.

Example

ts
export const metadata: Metadata = {
  alternates: {
    canonical: '/en/pricing',
    languages: { en: '/en/pricing', 'de-DE': '/de/pricing', 'x-default': '/en/pricing' },
  },
}

References

void seo reports 60 rules in this category. What search engines need from the raw response: status codes, titles and descriptions in <head>, self-referencing canonicals, one h1, crawlable links, Open Graph, icons, robots.txt and a sitemap with real dates.