Skip to content

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
DemchaAV merged 2 commits into
developfrom
fix/site-gallery-and-social-card
Sep 21, 2026
Merged

DemchaAV merged 2 commits into
developfrom
fix/site-gallery-and-social-card

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

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:image named a portrait page of one proposal, 893×1263. A large-image card is
landscape, 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 — presetClass and dataModel — in the form that preset's own runnable
    example uses: the no-argument create(), which carries the preset's theme rather than
    another'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:
    ConsultingInvoice takes StructuredInvoiceDocumentSpec where the block builds
    InvoiceDocumentSpec, 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.

  • SiteSocialCoverRenderer composes a 1200×630 cover with GraphCompose itself (a page
    declared in points, rasterised at 72 DPI, so the PNG is exactly that size), in the site's own
    palette, carrying the existing showcase/logo.svg wordmark, Document generation for Java,
    and three documents read from web/showcase/thumbnails/ — the previews the catalogue
    publishes, 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 and
    LinkedIn cache a preview by URL. twitter:card stays summary_large_image; both tags now
    declare 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 committed web/ is what web-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.
  • On the generated page of a preset the block does not compose: Compose this preset,
    BlueBanner.create(), and zero occurrences of BoxedSections. On the one it does:
    Compose it, unchanged.
  • The cover was rendered, opened and looked at. The first pass put the third document 48 points
    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, so
the first scrape after deploy gets the new cover. To confirm rather than assume:

  • X — Card validator
  • LinkedIn — Post Inspector
  • Facebook/Meta — Sharing debugger, Scrape again
  • Slack unfurls by URL too; a link posted in a channel where it was shared before may need
    ?v=2 appended once to force a re-unfurl.

DemchaAV and others added 2 commits September 22, 2026 00:14
…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.
@DemchaAV
DemchaAV merged commit 69cd8d1 into develop Sep 21, 2026
12 checks passed
@DemchaAV
DemchaAV deleted the fix/site-gallery-and-social-card branch September 21, 2026 23:31
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.

1 participant