Files
hoelee-blog/scripts/og-gen
hoelee 044ded45b3
Deploy / build (push) Successful in 19s
Add TRIM corruption sequel post + publish SATA cable post (en/zh, og+banner)
- New post: 'The Corruption Came Back on Different Drives — the Cause Was
  TRIM, Not the SSDs' — same 0x8941f998 zeros fingerprint on a second drive
  stack (IronWolf 110 SATA pair), root cause queued TRIM (FreeBSD gag 264139),
  fix diskAutotrim=off + nodiscard, scrub evidence, enterprise SATA buying
  guidance. en + zh, custom OG + banner.
- Publish formerly-draft SATA cable post (draft:false) with OG + banner.
- Correct drive identity in both: ZA960NM10001 is Seagate IronWolf 110, not
  'Samsung PM9A3' (PM9A3 is NVMe; FPDMA errors are SATA-only).
- Old RAID post (en+zh): cross-link to sequel, fix 'a Samsung' -> IronWolf 110.
2026-09-18 05:38:13 +08:00
..

og-gen — per-post OG image generator

Generates a branded 1200×630 social-share image for a blog post, matching the site's cobalt-blue #295cff branding, the logo-square.png mark, and the "terminal / debugging" visual style.

Usage

node scripts/og-gen/generate.mjs <post-slug>

Reads frontmatter (title, category, tags) from src/content/posts/<slug>.md, fills template.html, renders with headless Chrome, and writes public/og/<slug>.png.

The post's frontmatter needs ogImage: /og/<slug>.png so the blog serves it (layout already renders og:image + width/height; PostList shows it as a card thumbnail).

Customizing the terminal box

Each post shows a "terminal" panel (the red error / green fix lines). Add an entry keyed by slug in TERMINALS inside generate.mjs, using these tokens:

<div class="line"><span class="prompt">$</span><span class="cmd">command</span></div>
<div class="line"><span class="prompt">&nbsp;</span><span class="err">error line</span></div>
<div class="line"><span class="prompt">$</span><span class="cmd">fix</span><span class="fix">→ done ✓</span></div>

No entry → a generic default terminal.

Requirements

  • Google Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe (override with CHROME_PATH env var).
  • Node 20+.

Notes

  • PNG (not JPG) is intentional: for flat UI/terminal art, PNG is smaller and sharper than JPG (see commit history).
  • The logo-square.png referenced lives at public/logo-square.png.