Skip to content
Documentation
Rule catalogue

og.image.alt

Describe the shared image with og:image:alt

warningper pageguideline

Why it matters

Generated cards carry the page title as pixels. With no og:image:alt, that title is unavailable to anyone using a screen reader — at the moment a link is shared, which is before anyone has had the chance to open the page and find the text again.

What the finding looks like

The message goflag prints, with example values substituted.

warn og.image.alt Page declares an og:image with no og:image:alt.

Carry the alt per image, not as a constant

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

// app/…/opengraph-image.tsx — `export const alt` is one fixed string, so a
// translated or data-derived description has to go through the metadata fn.
export async function generateImageMetadata({ params }) {
  const t = await getTranslations({ locale: params.locale });
  return [{ id: "og", size, contentType, alt: t("og.alt") }];
}

Says who?

This rule is guideline, and it cites the document 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.