Guide · Astro

OG images for Astro, generated automatically

Astro layouts receive the page title as a prop, so one line in your base layout covers the whole site. Each page gets a crisp 1200×630 preview image the moment someone shares it — no design work, no image uploads.

Example Astro OG image generated by OGKit

1. Copy this snippet

<meta property="og:image" content={`https://ogkit-api.dsbotz.workers.dev/og?template=gradient&title=${encodeURIComponent(title)}&site=yoursite.com`} />

2. Where to paste it in Astro

Put it in src/layouts/BaseLayout.astro inside <head>.

3. Check the result

Paste any page URL into the free link preview checker to see exactly how it will look on X, LinkedIn, Slack and Facebook. Social networks cache previews, so re-share or use their debuggers after changing tags.

Why use OGKit with Astro?

  • Posts with a large image card get noticeably more clicks than bare links — and most Astro sites ship without one.
  • Images are rendered once at the edge and cached, so they load in milliseconds for crawlers.
  • 6 designer templates (blog, product, docs, minimal, gradient, photo) and your brand color.
  • Free forever with a small “made with OGKit” badge; paid plans remove it.

Parameters

template, title, desc, site, accent (hex), image (for product/photo), tag, author, date. Or use /auto?url= to read the title from the page itself. Full reference in the docs.

Other platforms