Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Goal
Generate a unique OpenGraph/Twitter card image per dataset detail page so links shared on Slack, Twitter, BlueSky, Discord, mailing lists, etc. show a branded preview with dataset-specific info instead of a generic placeholder.
Target preview
A 1200x630 PNG showing, for each dataset:
- Dataset short id (e.g.,
nm000104,on005262) — large mono - Dataset name (truncate to ~2 lines)
- Modality badges (EEG / MEG / iEEG / EMG)
- Participant count and total size
- NEMAR wordmark + brain accent (consistent across all cards)
- License chip if present
- Subtle dark/teal gradient background (brand palette)
Implementation options
- Astro endpoint that renders SVG → PNG at the edge. Add
src/pages/og/[id].png.tsthat fetches the dataset metadata, composes a 1200x630 SVG, returns it as PNG. Heavy on Workers CPU but cacheable. - Build-time generation. For static datasets, generate PNGs at build into
public/og/<id>.png. Skips runtime cost but won't pick up newly published datasets without a rebuild. - Satori (vercel/satori) for JSX → SVG. Lightweight, edge-runtime compatible, good typography. Closest to the recommended modern approach.
- Pre-render on dataset publish. When nemar-tools/nemar-cli publishes/updates a dataset, generate and upload the OG card to S3 (
s3://nemar/<id>/og.png); the website just references it.
Lean toward (3) Satori or (4) pre-render. (3) gives flexibility, (4) gives lowest runtime cost.
Wire-up
After image generation lands, add per-page OG meta tags in src/pages/dataset/[id].astro:
```html
```
Add canonical URL + structured data (`schema.org/Dataset`) in the same pass.
Acceptance criteria
- Sharing a dataset URL on Slack/Twitter shows the per-dataset card preview.
- OG image fits 1200x630, <300 KB, renders within ~200 ms at the edge (option 1/3) or is served as a static asset (option 2/4).
- Falls back gracefully if the dataset is missing fields.
- Twitter card validator and Facebook sharing debugger both report no errors.
Related
- Part of Phase 4 (Citation Dashboard + Community + Docs) or a polish item that ships ahead.
- Depends on `getMetadata()` / `getDataset()` returning enough fields. Tasks/modalities backfill is tracked in nemar-cli#512.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
neuromechanist commentedon Jul 29, 2026
Shipped. Per-dataset OG cards are generated at build time and served from
public/og/dataset/:scripts/generate-og-images.mjs(bun run generate:og, wired intobun run build) plusscripts/generate-site-og-image.mjsfor the site-level cardsrc/pages/og/dataset/[id].svg.tsand[id].png.tsfor the on-demand path,src/lib/og-image.ts/og-chrome.tsfor compositionwrangler.og-cron.toml,bun run deploy:og-cron) regenerates cards so newly published datasets pick one up without a manual rebuildThe generated PNGs are build artifacts, gitignored, not source.
The canonical-URL + schema.org structured-data follow-up mentioned at the end of this issue is tracked separately in #156.