Skip to content

fix(website): ship the social card the meta tags already promise - #423

Open
IanoNjuguna wants to merge 1 commit into
IntersectMBO:mainfrom
IanoNjuguna:fix/social-card
Open

IanoNjuguna wants to merge 1 commit into
IntersectMBO:mainfrom
IanoNjuguna:fix/social-card

Conversation

@IanoNjuguna

Copy link
Copy Markdown
Contributor

Description

Every page emitted an og:image and a twitter:image pointing at /img/docusaurus-social-card.jpg, a default Docusaurus ships that was never added to static/img. The live URL 404s, so every share of the site has been getting the summary_large_image layout with an empty image in it.

This renders the hero the site already has, rather than inventing a new card:

  • captured the landing hero at 1200 wide at 2× through CDP, clamped to the hero's own box so no strip of the next section leaks in
  • centred it on a full-size Caramel Delight (#FCE4C6) canvas, which is the hero's own surface colour in both themes
  • downsampled to exactly 1200×630, the 1.91:1 that summary_large_image expects
  • dropped the hero's two buttons from the capture, so the card does not look like it has clickable controls
  • themeConfig.image now points at the result

Two files: the PNG (150 KB) and one changed line in docusaurus.config.ts.

Fixes #422.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • I have tested these changes locally
  • I have checked for broken links

Checklist

  • My code follows the style guidelines
  • I have performed a self-review

Verification

build/img/social-card.png                153 838 bytes, 1200 x 630, PNG
og:image on docs/getting-started         https://devex.intersectmbo.org/img/social-card.png
og:image on the older tutorial page      https://devex.intersectmbo.org/img/social-card.png
pages still naming docusaurus-social-card 0
npm run build                            SUCCESS

Edge pixels checked after composition rather than assumed: both the top-right and bottom-left corners are rgb(252, 228, 198), so there is no white sliver from the neighbouring section.

Notes

  • One card for the whole site. Per-page cards are a later, separate change through frontmatter image:; the tutorial and the new Beginner page are the two that would benefit most.
  • The card is a PNG because the source hero is WebP with alpha and the composition needs a flat surface behind it. 150 KB at 1200×630 is smaller than most screenshots people paste into these cards.
  • The hero render will drift if the landing hero is redesigned. The capture is checked in as an asset, so the fix is to re-render, not to rediscover the bug.

themeConfig.image named img/docusaurus-social-card.jpg, a default that was
never added to static/img, so og:image and twitter:image resolved to a 404 on
every page while twitter:card declared summary_large_image.

The card is the landing hero rendered at 2x and composed to 1200x630 on its own
Caramel Delight surface, with the hero buttons dropped so the card does not look
clickable.

This branch has not been deployed

No deployments
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.

docs(site): every link preview points at a social card that does not exist

1 participant