fix(web): give a preset card its own code, lead with the catalogue, and draw a link preview for the shape a link preview is - #704
Merged
Conversation
…nd draw a link preview for the shape a link preview is Four things a visitor met on the showcase home page. A card of a preset showed its family's compiled block - the CVs' builds BoxedSections, the invoices' ModernInvoice - captioned as coming from the documentation. The caption was true and the code under it still drew a different document, which is what a reader copies. Those cards now carry the smallest block that draws the preset they are looking at, built from the preset and the record the card already states, in the form the preset's own runnable example uses: the no-argument create(), which carries the preset's theme rather than another's. Not the family block with its composing line rewritten - ConsultingInvoice takes StructuredInvoiceDocumentSpec where that block builds InvoiceDocumentSpec, so a rewrite would hand a reader a record the preset does not accept. The catalogue was below the Maven coordinates and a format-by-format comparison, so the page asked a visitor to install something before showing them anything it draws. It now follows the opening block. Ids and anchors are unchanged, so existing links and shared viewer addresses still land where they did. The line above it promised the rendered PDF on a click; a viewer opens. og:image and twitter:image named a portrait page of one proposal, 893x1263. A large-image card is landscape, so X published a band cropped from its middle. SiteSocialCoverRenderer composes a cover at 1200x630 with GraphCompose itself, in the site's palette, carrying the wordmark, what the library does, and three documents read from the previews the catalogue publishes. No version, no figure - it outlives the release that published it. Published under a name of its own, because the platforms cache a preview by URL.
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.
Why
Four things a visitor meets on the showcase home page.
A preset card showed code that draws a different preset. The catalogue carries one
compiled block per family — the CVs' builds
BoxedSections, the invoices'ModernInvoice—and every other card of the family was shown it, captioned From the docs. The caption was
honest; the code under it still drew another design, and that is what a reader copies.
The catalogue sat below the install block and a format-by-format comparison, so the page
asked a visitor to add a dependency before showing them anything the library draws.
The line above the catalogue promised a PDF on a click. A viewer opens.
og:imagenamed a portrait page of one proposal, 893×1263. A large-image card islandscape, so X cropped a band out of its middle and published a paragraph of a document
nobody had asked about, under a link about the library.
What changed
A preset card carries the smallest block that draws its own preset, built from what the
card already states —
presetClassanddataModel— in the form that preset's own runnableexample uses: the no-argument
create(), which carries the preset's theme rather thananother's. The family's block stays on the one card it composes; the link to the page it is
published on stays on all of them.
It is not that block with its composing line rewritten, and the invoices are why:
ConsultingInvoicetakesStructuredInvoiceDocumentSpecwhere the block buildsInvoiceDocumentSpec, so a rewrite would hand a reader a record the preset does not accept.Checked before writing it: all 56 preset classes in the catalogue expose a no-arg
create().The catalogue follows the opening block, ahead of install and formats. Every id and
anchor is unchanged, so existing links and shared viewer addresses land where they did.
The intro says what a click does — the viewer, what it pages through, and what it links.
SiteSocialCoverRenderercomposes a 1200×630 cover with GraphCompose itself (a pagedeclared in points, rasterised at 72 DPI, so the PNG is exactly that size), in the site's own
palette, carrying the existing
showcase/logo.svgwordmark, Document generation for Java,and three documents read from
web/showcase/thumbnails/— the previews the cataloguepublishes, so the cover cannot show a template the site does not have. No version, no
measured figure: it outlives the release that published it. Published at
web/assets/social/graphcompose-cover-2026-09.png, a name of its own, because Slack, X andLinkedIn cache a preview by URL.
twitter:cardstayssummary_large_image; both tags nowdeclare the size, the type and an alt text. A document's own page keeps its own preview —
there the document is the subject.
Verification
node scripts/site/gallery-viewer.test.mjs,build.test.mjs,home.test.mjs— all pass.Two cases asserted the old contract and were rewritten to the new one rather than deleted:
the family block is now expected on the card it composes, and a case was added for the card
it does not.
node scripts/site/build.mjs --check— the committedweb/is whatweb-src/builds../mvnw test -pl :graph-compose-core -Dtest='ShowcaseSiteGuardTest,ShowcaseCardInstructionsTest,ShowcaseSnippetScopeTest,ShowcaseBundledFontClaimTest,VersionConsistencyGuardTest'— 42 tests, 0 failures../mvnw test -f qa/pom.xml -Dtest=DocumentationExamplesTest— 12 tests, 0 failures.Compose this preset,BlueBanner.create(), and zero occurrences ofBoxedSections. On the one it does:Compose it, unchanged.past the right edge — a layout no assertion would have caught, and the reason the fan's
geometry is now derived from the page width with the arithmetic written down beside it.
After merge
GitHub Pages redeploys on push to
main. The platforms cache by URL, and the URL is new, sothe first scrape after deploy gets the new cover. To confirm rather than assume:
?v=2appended once to force a re-unfurl.