Repository navigation
Add share cards for every page - #10
Merged
appdever01 merged 2 commits intoNov 18, 2026
Merged
Conversation
Generate a 1200x630 Open Graph card per page on the server: a leaderboard podium for home and /community, the component name for each library page, and a plain card for the other indexed pages.
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.
Link previews for OpenCircle used the same static image on every page. This PR generates a 1200×630 card for each page on the server, so a shared link shows what the page is about.
What each page shows
public/og.png. If no leaderboard has been saved yet, the page keeps the static image./components/split-footer,/components/icon-folder,/components/draw-a-line): the component name as the title, plus its description, category and tags. Long names shrink and stop at three lines with an ellipsis.Forum posts, blog posts and events keep the cards they already had. Private pages (admin, portfolio and similar) get none.
How it works
Three new routes draw the cards:
/api/home-image,/api/page-imageand/api/component-image. They reuse the satori and resvg renderer fromserver/forum-image.ts, which now exposescardAssets,renderCardandcachedImageso the home card can use its own layout.The Node server and the Vite plugin write the
og:imagetags into the HTML, and client-side navigation sets the same tags, including the podium on /community. Image URLs carry a short version hash, so an edited description is not served from cache.robots.txtallows the three routes.Component names, descriptions, categories and tags moved to
shared/component-meta.ts, which the registry now spreads from. The server can read them without importing the demo code.Satori cannot fetch pictures, so the server loads avatars itself. It accepts only
avatars.githubusercontent.com, with a 3 second timeout, a 512 KB cap and no redirects. If one fails, that seat shows a grey circle.The home card reads the saved leaderboard snapshot only. A share card never waits on a GitHub refresh.
Testing
pnpm typecheckis clean andpnpm lintreports no errors.pnpm testpasses (747 tests). New tests are intests/page-image.test.tsandtests/component-seo.test.ts. They cover every page's image tag, each component URL, long titles, bad slugs and paths, and the case with no saved leaderboard.tests/forum-meta.test.tsxexpected /tools to useog.png. It now expects the page card.Previews
Home and /community,
/components/draw-a-line, and a very long component name:(drag in
home.png,component-draw-a-line.pngandcomponent-long-name.png)