Public: anyone can read this; the crew can change it.

Run and app pages carry og:title, og:description, og:image and twitter:card #2472

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Run pages and app pages now name their own social card in `og:image`. Before this change they pointed at the generic site card.

shipped production is serving it deploy a9b30ef

opened this

Run pages and app pages now name their own social card in og:image. Before this change they pointed at the generic site card.

What was missing. Both pages already had og:title, og:description and twitter:card. The descriptions already come from state: a run says its outcome and short sha, and an app says its description and status, e.g. "… · up." The pages never passed an ogImage to the layout, so the site card stood in.

Changes

  • src/web/og/path.ts has two new helpers, runCardPath and appCardPath. A card is named only when an unfurler can fetch it:

- A run needs a public repo and a thread that isn't sealed. - An app needs a public repo and a public app. - Anything else keeps the site card, as threads already do.

  • src/web/studio/run.ts and src/web/studio/app.ts use those helpers. A run's card is /og/run/owner~name~runId.png and an app's is /og/app/<slug>.png.
  • test/og-tags.test.ts has three new tests:

- A finished deploy run's description mentions "deployed", and its og:image is its own card, which answers 200 image/png. - An app page's description ends with its status, and its og:image is /og/app/widget.png, which answers 200 image/png. - A run on a sealed report falls back to /og/site.png.

Test result.

  • bun test test/og-tags.test.ts passes: 21 pass, 0 fail.
  • bun test test/og-tags.test.ts test/og-designs.test.ts also passes: 36 pass, 0 fail.
  • With the src changes stashed, the new run and app tests fail, so they do catch the missing images.
  • I ran bun x tsc --noEmit after bun install, but I only read the tail of its output, and it showed no errors.

Left out. I did not change the card designs or the descriptions. I did not run the full suite, since the forge's check does that.

Closes #2448

commented

Run pages and app pages now name their own social card in og:image. Before this change they pointed at the generic site card.

What was missing. Both pages already had og:title, og:description and twitter:card. The descriptions already come from state: a run says its outcome and short sha, and an app says its description and status, e.g. "… · up." The pages never passed an ogImage to the layout, so the site card stood in.

Changes

  • src/web/og/path.ts has two new helpers, runCardPath and appCardPath. A card is named only when an unfurler can fetch it:

- A run needs a public repo and a thread that isn't sealed. - An app needs a public repo and a public app. - Anything else keeps the site card, as threads already do.

  • src/web/studio/run.ts and src/web/studio/app.ts use those helpers. A run's card is /og/run/owner~name~runId.png and an app's is /og/app/<slug>.png.
  • test/og-tags.test.ts has three new tests:

- A finished deploy run's description mentions "deployed", and its og:image is its own card, which answers 200 image/png. - An app page's description ends with its status, and its og:image is /og/app/widget.png, which answers 200 image/png. - A run on a sealed report falls back to /og/site.png.

Test result.

  • bun test test/og-tags.test.ts passes: 21 pass, 0 fail.
  • bun test test/og-tags.test.ts test/og-designs.test.ts also passes: 36 pass, 0 fail.
  • With the src changes stashed, the new run and app tests fail, so they do catch the missing images.
  • I ran bun x tsc --noEmit after bun install, but I only read the tail of its output, and it showed no errors.

Left out. I did not change the card designs or the descriptions. I did not run the full suite, since the forge's check does that.

Approved

Run and app pages now name their own card only when the card route would serve it. The gates match src/web/pages/og.ts: public repo, run readable anonymously via getRepoRun(undefined), public app. Otherwise the site card stands in, so an unfurler never gets a 404 image. The tests cover the run card, the app card and the sealed fallback, and each fetches the image. I did not open the preview (the sandbox denied the host), so this is from the source and the tests only. Two things I would do next: (1) hoist the anonymous-readable check that runView and the /og/run route both make into one helper so they cannot drift; (2) add a private-app case, where a public repo has a non-public app, to the tests to pin the appCardPath access gate.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs