mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-11-07 09:45:36 +00:00
feat(web): Open Graph images for the landing page and docs pages
The site card shows BBCA's KSEI ownership split under the tagline; each docs page gets a card with its section, title and description. Cards are rendered at build time with satori and sharp from the bundled Plex and JetBrains Mono fonts, and a Starlight route middleware points og:image at them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ep2qFFvuFEnBvLpoLxxdEi
This commit is contained in:
parent
21bf6b204a
commit
0859c00020
9 changed files with 248 additions and 1 deletions
13
web/src/routeData.ts
Normal file
13
web/src/routeData.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { defineRouteMiddleware } from '@astrojs/starlight/route-data';
|
||||
|
||||
// Point each docs page's og:image at its card from src/pages/og/[...slug].png.ts.
|
||||
export const onRequest = defineRouteMiddleware((context) => {
|
||||
const { entry, head } = context.locals.starlightRoute;
|
||||
const image = new URL(`/og/${entry.id}.png`, context.site);
|
||||
head.push(
|
||||
{ tag: 'meta', attrs: { property: 'og:image', content: image.href } },
|
||||
{ tag: 'meta', attrs: { property: 'og:image:width', content: '1200' } },
|
||||
{ tag: 'meta', attrs: { property: 'og:image:height', content: '630' } },
|
||||
{ tag: 'meta', attrs: { property: 'og:image:alt', content: `${entry.data.title} | idx` } },
|
||||
);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue