Add Open Graph and social card metadata configuration#6494
Draft
theosanderson wants to merge 3 commits into
Draft
Add Open Graph and social card metadata configuration#6494theosanderson wants to merge 3 commits into
theosanderson wants to merge 3 commits into
Conversation
Add og:image and twitter:image meta tags to BaseLayout, populated from the current organism's configured image when the page is within an organism context (either via the URL `:organism` param or the `implicitOrganism` prop, e.g. on sequence detail pages). The organism image path is resolved against the current URL so the emitted meta tag contains an absolute URL, as required by social platforms when generating link previews.
Introduce a top-level `openGraph` config object (image + description) so instances can configure their site-wide social card without hand-rolling `<meta>` tags via `additionalHeadHTML`. Plumb it through the helm chart (values.schema.json + _common-metadata.tpl). BaseLayout now emits a coherent set of social tags: - og:type, og:url, og:title (already present), og:description, og:image - twitter:card (summary_large_image when an image is available, otherwise summary), twitter:url, twitter:title, twitter:description, twitter:image - <meta name="description"> for general SEO Image resolution: 1. The current organism's `schema.image` when the page is within an organism context (URL `:organism` param or `implicitOrganism` prop). 2. Otherwise the site-wide `openGraph.image`. Description resolution: 1. A per-page `description` prop on BaseLayout (new optional prop). 2. Otherwise the site-wide `openGraph.description`. Image paths are resolved against the current URL so the emitted absolute URLs satisfy what social platforms require.
Add an optional `twitterCard` field to the top-level `openGraph` config, typed as an enum of the four card types Twitter/X supports (`summary`, `summary_large_image`, `player`, `app`). The schema is enforced both in the website's zod config and the helm chart's values.schema.json. When unset, the previous defaulting logic is preserved: `summary_large_image` if a card image is available (either from the current organism's `schema.image` or from `openGraph.image`), otherwise `summary`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds support for configuring Open Graph and social card metadata at the site level. This allows customization of how pages appear when shared on social media platforms.
Changes
Schema & Config: Added
openGraphconfiguration object to the Helm values schema and website config with support for:image: Default Open Graph image (relative paths resolved against page URL)description: Default meta description for pagestwitterCard: Twitter card type (summary,summary_large_image,player,app)Layout: Updated
BaseLayout.astroto:descriptionpropsummary_large_imageif image is configured, otherwisesummaryHelm: Added template support for passing
openGraphconfiguration to the website configPR Checklist
Testing
No additional testing needed. The changes are configuration-driven and the meta tag generation is straightforward. Existing tests should cover the layout rendering, and the configuration schema validation will catch any invalid inputs.
https://claude.ai/code/session_01M5PyXCAKKjLKGvyDV7Z9pZ
🚀 Preview: Add
previewlabel to enable