-
Notifications
You must be signed in to change notification settings - Fork 0
Add OG img generation #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds Open Graph image generation: new OG route that renders images from docs metadata, a Head component injecting og:image/twitter:image, Astro config updates (site, Head integration, vite SSR externalization), two new dependencies, and a .gitignore entry for Changes
Sequence Diagram(s)sequenceDiagram
participant Browser
participant DocsPage as "Docs Page"
participant HeadComp as "Head Component"
participant OGRoute as "/og/* handler"
participant OGGen as "OG Image Generator"
Browser->>DocsPage: GET /docs/... (render)
DocsPage->>HeadComp: render head (Starlight entry)
HeadComp->>HeadComp: compute route -> `/og/{route}.png`
HeadComp->>Browser: emit meta tags (og:image, twitter:image)
Note over Browser,OGRoute: Social preview or crawler requests OG image
Browser->>OGRoute: GET /og/{route}.png
OGRoute->>OGRoute: fetch docs collection, map route -> metadata
OGRoute->>OGGen: generate PNG (title, desc, fonts, logo, bg)
OGGen->>Browser: return image/png
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlsrc/assets/fp-logo.pngis excluded by!**/*.pngsrc/assets/og-bg.pngis excluded by!**/*.png
📒 Files selected for processing (6)
.gitignore(1 hunks)astro.config.ts(3 hunks)package.json(1 hunks)src/components/Head.astro(1 hunks)src/pages/og/[...route].ts(1 hunks)src/styles/custom.css(0 hunks)
💤 Files with no reviewable changes (1)
- src/styles/custom.css
🔇 Additional comments (1)
.gitignore (1)
26-28: LGTM!Adding
.wrangler/to the ignore list is appropriate and necessary for Cloudflare Workers tooling. The placement and formatting align with existing patterns in the file.
Add OG image generation
Implements automatic Open Graph image generation for all documentation pages using
astro-og-canvas, matching the implementation from the blog.Changes
src/pages/og/[...route].tsthat generates images for all docsHeadcomponent to inject OG and Twitter Card meta tagsog-bg.png,fp-logo.png) for consistent Fiberplane brandingastro.config.tsto externalizecanvaskit-wasmfor Cloudflare Workers compatibilityAlso removed a color override that resulted in a jarring difference in border colors. 🎨
Result
Generates 28 OG images (1200×630) with Geist Sans typography for social media previews.
Summary by CodeRabbit
New Features
Chores
Style