hreflang.missing
Pages on a multilingual site must advertise their locale alternates
errorsite-wide
Why it matters
This is the blind spot goflag was built to close. Without alternates, an engine cannot tell four translations of a page from four competing pages, so they consolidate nothing and split each other's authority.
What the finding looks like
The message goflag prints, with example values substituted.
error hreflang.missing Page declares no hreflang alternates, but the site serves 4 locales (en, es, fr, pt-br, per the sitemap). Locale variants of this route cannot be associated with each other.
Emit alternates from generateMetadata()
Written for the Next.js App Router. The finding is correct on any stack; only the remedy assumes one.
// app/[locale]/…/page.tsx
export async function generateMetadata({ params }) {
const { locale } = await params;
return {
alternates: {
canonical: `${baseUrl}/${locale}${path}`,
languages: {
"en": `${baseUrl}/en${path}`,
"fr": `${baseUrl}/fr${path}`,
"x-default": `${baseUrl}/${defaultLocale}${path}`,
},
},
};
}Says who?
This rule runs on the cross-page contract, which does not yet carry sources. It picks them up when the site-level rules move onto the same descriptor as the page rules.