Skip to content
Documentation
Rule catalogue

og.locale.alternates

og:locale:alternate and the hreflang cluster must name the same locales

warningper pagevendor-spec

Why it matters

The same fact — this page exists in these languages — is written twice, in two vocabularies, by two pieces of code. Nothing in a build compares them, so they drift apart quietly, and the shorter list is the one hiding a translation somebody paid to have made.

What the finding looks like

The message goflag prints, with example values substituted.

warn og.locale.alternates Open Graph and hreflang disagree about this page's translations: no og:locale:alternate for es, fr.

Derive both lists from the same cluster

Written for the Next.js App Router. The finding is correct on any stack; only the remedy assumes one.

// The hreflang map and the OG locales are one fact stated twice.
openGraph: {
  locale: ogLocale(locale),
  alternateLocale: cluster.filter((l) => l !== locale).map(ogLocale),
},
alternates: { languages: cluster },

Says who?

This rule is vendor-spec, and it cites the documents below. Nothing here is goflag’s opinion of what a good page looks like — if you disagree with a finding, this is what you are disagreeing with.