Skip to content

Commit f2708fc

Browse files
committed
docs: scripts: Add README for OG image generation
1 parent f4a593a commit f2708fc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# OG Image Generation Scripts
2+
3+
This directory contains scripts to automatically generate Open Graph (OG) images for social media sharing.
4+
5+
## Workflow
6+
7+
1. **`collectOgData.js`**: This script crawls the `content/` directory, extracts front matter (`title`, `description`), and creates a manifest file at `tmp/ogImageData.json`. This manifest includes data for all pages that should have an OG image generated.
8+
2. **`generateOgImages.js`**: This script reads the manifest, uses Puppeteer (a headless browser) to render an HTML template (`assets/og-template/template.html`) with the page's data, and saves screenshots as JPGs in the appropriate content or static directories. It uses a cache manifest (`tmp/og-cache-manifest.json`) to avoid regenerating unchanged images.
9+
10+
## Running the Scripts
11+
12+
Run both scripts as part of the build process:
13+
14+
```bash
15+
npm run og-images

0 commit comments

Comments
 (0)