Open Graph Info
Open Graph Info
<OpenGraphInfo> adds the social-sharing meta tags (Open Graph and Twitter card) for a page, so a link to it shows a proper preview image, title, and description when shared. Add it once near the top of a React page.
Basic Usage
Site-wide default image only:
<OpenGraphInfo />
Page-specific image:
<OpenGraphInfo pageName="apps" />
With title and description:
<OpenGraphInfo
pageName="apps"
title="Cardano Apps and dApps"
description="Discover curated apps live on Cardano mainnet today."
/>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
pageName | string | default | Base name of the preview image. Resolves to static/img/og/<pageName>.jpg. Pages without a dedicated image omit it and get the site-wide static/img/og/default.jpg. |
title | string | none | Sets og:title and twitter:title. Omit to leave the page's own title. |
description | string | none | Sets og:description and twitter:description. |
Notes
- The preview image must live in
static/img/og/and be a.jpgnamed exactly<pageName>.jpg. og:imageandtwitter:imageuse the same file, there is no separate Twitter image.og:typeis alwayswebsiteandtwitter:cardis alwayssummary_large_image. Neither is configurable.- The canonical
og:urlis derived automatically from the current path, andog:site_namefrom the site config. You do not set these. - Use
summary_large_imagepreviews, so design the image for a wide 1.91:1 crop.