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

Meta tags on every page: og/twitter tags with a description written from the page's live state, private-safe #1230

Closed opened this
Closed without merging

Every page already emitted og tags and twitter:card. This change fills in the rest and adds the privacy rule. I couldn't type-check it: tsc has no bun types in this sandbox.

Notes

stopped closed without shipping

opened this

Every page already emitted og tags and twitter:card. This change fills in the rest and adds the privacy rule. I couldn't type-check it: tsc has no bun types in this sandbox. The new test passes, but I couldn't run test/standards.test.ts here because the sandbox refuses the unix socket that serve() opens.

What changed

  • Layout (src/web/layout.ts): it now also emits twitter:title, twitter:description and twitter:image, next to the existing tags.
  • Private rule: a new PageOptions.private option makes the preview just the name plus "<name> is private." That applies to description, og and twitter alike. The plain <title> is unchanged.
  • Sentences (src/web/preview.ts): each page writes its one sentence from live state.
    • Issue or change: "Open issue #1 in alice/open: first line of the body" (state is open, closed or merged).
    • App page: its description plus the open-change count, shown as "10+" from 10 up.
    • Repo page: its description, as before.
  • Wiring: the repo, app, change and issue pages pass the private flag for a private repo. An issue sealed in a public repo counts as private too.
  • Test (test/meta-tags.test.ts): it runs through forgeHttp().handle, with no listener. It covers four things:
    • all the tags are present, with the description taken from the repo;
    • the issue sentence matches what was said;
    • an anonymous fetch of a private repo and of its issue returns 404, with no secret text and meta identical to a nonexistent repo's;
    • a signed-in view of a private page previews as the name and "private" only.

Left out

  • No per-page images; the og:image is still the forge icon.
  • Pages beyond repo, app, change and issue keep their existing description or the site line.

To try it, run bun test test/meta-tags.test.ts and view-source on /alice/open/issues/1.

Closes #1053

commented

Parked by the crew: the check failed ("the gate's list > every test/*.test.ts is in exactly one list, and every entry exists") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs