Skip to content

fix: emit og:image instead of og:image:url for images array#134

Open
nureddinhaji wants to merge 1 commit intoartiebits:masterfrom
nureddinhaji:fix/og-image-meta-tag
Open

fix: emit og:image instead of og:image:url for images array#134
nureddinhaji wants to merge 1 commit intoartiebits:masterfrom
nureddinhaji:fix/og-image-meta-tag

Conversation

@nureddinhaji
Copy link
Copy Markdown

Problem

The images handler in open-graph.svelte emits og:image:url instead of bare og:image for the url key. Without the root og:image tag, most social platforms (Facebook, LinkedIn, Twitter/X, Discord, Slack) do not pick up the image.

The videos handler already correctly special-cases url to emit og:video, but the images handler was missing this same logic — a copy-paste inconsistency.

Fix

Mirror the videos pattern: when imgKey === "url", emit og:image instead of og:image:url.

{@const prop = imgKey === "url" ? "og:image" : \`og:image:\${imgKey}\`}

One line changed.

References

  • OG spec on structured properties: https://ogp.me/#structured
  • The spec's own examples always use bare og:image, not og:image:url alone
  • og:image is listed as one of the four required basic metadata properties

Tests

Updated the existing test to assert og:image instead of og:image:url. All 81 tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant