feat: custom OG image generation with SVG template#408
Open
Conversation
- Replace Vocs default OG handler with resvg-based SVG template renderer - SVG template with ASCII art background, MPP logo, category/subcategory - Smart title wrapping with balanced line distribution (balanceLines) - Per-route descriptions via scripts/og-descriptions.json - Licensed VTC Du Bois font served from Vercel Blob (replaces trial .woff2) - Static og.png for landing page, dynamic /api/og for all other routes - Vercel rewrite proxies /fonts/VTCDuBois-* from Blob storage - Font files gitignored; upload via scripts/upload-fonts.ts
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| "rewrites": [ | ||
| { | ||
| "source": "/fonts/VTCDuBois-:path*", | ||
| "destination": "https://wgfdjv2jfqz2dlpx.public.blob.vercel-storage.com/fonts/VTCDuBois-:path*" |
| .env.local | ||
|
|
||
| # Licensed font files (served via Vercel Blob in production) | ||
| public/fonts/VTCDuBois* |
| @@ -0,0 +1,40 @@ | |||
| import { readFileSync } from "node:fs"; | |||
Collaborator
There was a problem hiding this comment.
I think we can remove this?
| @@ -0,0 +1,48 @@ | |||
| { | |||
| "/overview": "The open protocol for machine-to-machine payments, built on an open IETF specification for HTTP 402", | |||
Collaborator
There was a problem hiding this comment.
what is the default here? its a little gnarly we need to manually maintain this -- can we not just pull from vocs frontmatter?
| @@ -0,0 +1,170 @@ | |||
| import { existsSync, mkdirSync, readFileSync } from "node:fs"; | |||
Collaborator
There was a problem hiding this comment.
do we need to check this one in?
Collaborator
There was a problem hiding this comment.
is this an interntional revert?
Collaborator
There was a problem hiding this comment.
do we need to check in these?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/og-descriptions.jsonog.pngfor landing page, dynamic/api/ogfor all doc routesBefore / After
Before (Vocs default):
After (custom template):
Files changed
src/pages/_api/api/og.tsx— resvg-based SVG template renderersrc/pages/_api/api/og-template.svg— brand SVG templatescripts/og-descriptions.json— per-route OG descriptionsscripts/upload-fonts.ts— Vercel Blob font uploaderscripts/generate-og-images.ts— batch preview generatorvercel.json— font rewrite to Blobvocs.config.ts— pass path param in ogImageUrl.gitignore— exclude licensed font files_root.css/_layout.tsx— licensed font refsTest plan