Skip to content
Documentation
Rule catalogue

canonical.missing

Declare a <link rel="canonical"> so search engines pick the right URL

warningper pagevendor-spec

Why it matters

Any tracking parameter, trailing slash or uppercase path creates a second URL serving the same page. Without a canonical, the engine picks which one to keep, and it does not have to pick yours.

What the finding looks like

The message goflag prints, with example values substituted.

warn canonical.missing Page is missing <link rel="canonical">.

Declare the canonical URL

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

// app/…/page.tsx — relative canonicals resolve against metadataBase,
// which defaults to localhost and silently breaks in production.
export const metadata = {
  metadataBase: new URL(process.env.NEXT_PUBLIC_SITE_URL!),
  alternates: { canonical: "/the-page" },
};

Says who?

This rule is vendor-spec, and it cites the documentsbelow. 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.