Skip to content

feat(tools): per-category embeddable badge SVG + gallery#3191

Open
0motionguy wants to merge 1 commit into
mainfrom
feat/category-badge-svg-v2
Open

feat(tools): per-category embeddable badge SVG + gallery#3191
0motionguy wants to merge 1 commit into
mainfrom
feat/category-badge-svg-v2

Conversation

@0motionguy

Copy link
Copy Markdown
Owner

Extends the star-history SVG embed pattern to category ranking badges. README authors can embed a live 'Trending in ' SVG — every embed is free viral marketing. 32 categories × 1 badge route. Companion PRs: #3174 C-CAT, #3185 classify, Toolbox #241.

Extends the existing star-history SVG embed pattern (v3 deltas
defensibility 2.0) to category ranking badges. README authors can
embed a live "Trending in <Category>" SVG badge — every embed is
free viral marketing for TrendingRepo.

Files:
- src/app/api/og/category-badge/[slug]/route.tsx (new) — dynamic
  [slug] = one of 32 category ids. Returns image/svg+xml self-
  contained (no external font/image refs, inline system-font stack).
  Reads consensus-trending + repo-categories maps; renders top-3
  ranked repos + composite scores for the category. Cache-Control:
  s-maxage=3600, swr=86400.
- src/app/api/og/category-badge/__tests__/ — vitest assertions on
  valid SVG XML + content-type + slug-derived category name in output.
- src/app/tools/category-badges/page.tsx + loading.tsx + error.tsx
  (new) — gallery showing all 32 badges with markdown snippet to copy.
- src/app/tools/page.tsx (modified, +7 lines) — adds Category Badges
  entry to CHART_TOOLS array next to Treemap and Star History.
- vitest.config.ts (modified) — adds the badge route test pattern
  (next/server requires the vitest loader path, same as oembed/x402).

No publicly stale batches: when consensus-trending is past 4h, the
badge renders a "Refreshing" state instead of stale top-3.

Companion PRs: C-CAT #3174 (taxonomy ids), classify #3185 (per-repo
assignments), per-category-pages #3181 (HTML landing), Toolbox #241
(ULTRA harness).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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