All rules
optional
Rule: alternates-hreflangWeight: 4/100

Rule: alternates-hreflang

Hreflang tags tell search engines about the language and regional targeting of your pages. If you have multiple language versions of a page (/en/about, /fr/about), hreflang links them so Google shows the right version to each user. This rule currently reports hreflang information found on the page but always passes — it's informational, not prescriptive.

Run the check
$ npx indxel check
Look for alternates-hreflang in the output

What it checks

Indxel scans for <link rel="alternate" hreflang="..."> tags in the HTML head. It reports what it finds (languages, region codes, URLs) but does not validate correctness. The rule always passes regardless of whether hreflang tags are present. It's an informational check included for completeness.

Thresholds

PASS

Always passes — informational only

Edge cases

1

This rule is intentionally non-prescriptive. Not every site needs hreflang. It only applies to multi-language sites.

2

Hreflang x-default: the special value hreflang="x-default" indicates the fallback URL for users whose language doesn't match any specified alternate. Indxel reports this but doesn't require it.

3

Bidirectional requirement: if page A hreflang-links to page B, page B must also hreflang-link back to page A. Indxel currently does not validate this bidirectionality (it would require crawling both pages).

4

In Next.js, hreflang is set via alternates.languages in metadata. Example: alternates: { languages: { en: '/en/about', fr: '/fr/about' } }.

Configuration

indxel.config.ts
// indxel.config.ts
import { defineSEO } from "indxel";

export default defineSEO({
  rules: {
    "alternates-hreflang": true, // enabled by default
  },
});

// Set hreflang in Next.js metadata:
export const metadata = {
  alternates: {
    canonical: "https://example.com/about",
    languages: {
      en: "https://example.com/en/about",
      fr: "https://example.com/fr/about",
      "x-default": "https://example.com/about",
    },
  },
};

Frequently asked questions

Why does this rule always pass?

Hreflang is only relevant for multi-language sites. Requiring it on all sites would create false positives for the vast majority of English-only sites. The rule is informational — it reports what it finds so you can verify correctness manually.

Should I add hreflang if my site is English-only?

If your site is available in only one language, you don't need hreflang tags. The canonical URL is sufficient. Hreflang is only needed when you have the same content in multiple languages or regional variations.

Will this rule become stricter in the future?

Possibly. Future versions may validate hreflang format (e.g., correct language codes), bidirectional links, and consistency across pages. For now, it's informational only.

Related rules

canonical-url

critical — 10/100

Validate your SEO now

$npx indxel check
Get startedBrowse all rules
Indxel

SEO validation that runs in your terminal and blocks bad deploys.

GitHubnpm

Product

  • Documentation
  • Pricing
  • Plus Plan
  • CI/CD Guard
  • Indexation
  • Free Tools
  • Blog

Comparisons

  • vs Semrush
  • vs Ahrefs
  • vs Moz
  • vs Screaming Frog
  • All comparisons

Integrations

  • Vercel
  • GitHub Actions
  • Netlify
  • Docker
  • All integrations

Resources

  • Frameworks & use cases
  • Next.js
  • For freelancers
  • For agencies
  • SEO Glossary

Built with care. MIT Licensed.

PrivacyTermsLegalContact