Skip to content

Commit 8d1866a

Browse files
JacobCoffeeclaude
andcommitted
add dynamic OG image generation for blog posts
Uses satori + @resvg/resvg-js to generate unique OG images at build time for every post. Dark editorial design with Python branding, title, author, date, and tag pills. Bumps pre-commit large file threshold for bun.lock. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d6ec79a commit 8d1866a

File tree

6 files changed

+394
-2
lines changed

6 files changed

+394
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: check-json
1010
- id: check-merge-conflict
1111
- id: check-added-large-files
12-
args: [--maxkb=200]
12+
args: [--maxkb=500]
1313

1414
- repo: https://github.com/crate-ci/typos
1515
rev: v1.32.0

bun.lock

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
"@astrojs/sitemap": "^3.7.0",
1919
"@keystatic/astro": "^5.0.6",
2020
"@keystatic/core": "^0.5.48",
21+
"@resvg/resvg-js": "^2.6.2",
2122
"astro": "^5.17.1",
2223
"cmdk": "^1.1.1",
2324
"react": "^19.2.4",
2425
"react-dom": "^19.2.4",
26+
"satori": "^0.19.2",
2527
"unist-util-visit": "^5.1.0"
2628
},
2729
"devDependencies": {

src/layouts/BlogPostLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const sortedGroups = [...refGroups.entries()]
4343
.sort((a, b) => (groupMeta[a[0]]?.order ?? 99) - (groupMeta[b[0]]?.order ?? 99));
4444
---
4545

46-
<BaseLayout title={`${title} | Python Insider`} description={description ?? undefined}>
46+
<BaseLayout title={`${title} | Python Insider`} description={description ?? undefined} image={slug ? withBase(`/og/${slug}.png`) : undefined}>
4747
<div class="relative mx-auto flex max-w-6xl gap-10">
4848
<article class="prose mx-auto min-w-0 max-w-3xl flex-1">
4949
<header class="not-prose mb-10 animate-fade-up">

0 commit comments

Comments
 (0)