ARTICLE AD BOX
Problem
I'm building a CMS publishing pipeline where I need to validate SEO metadata before content goes live. I need to:
Detect if a SERP title will be truncated in Google search results
Validate Open Graph image dimensions before publishing
Validate Twitter/X Card images per card type (summary vs summary_large_image)
What I'm doing now
// ❌ Inaccurate — character count ≠ pixel width if (title.length > 60) { console.warn('Title might be too long'); } // ❌ Incomplete OG validation if (width < 1200 || height < 630) { console.warn('OG image too small'); }Why this fails
Google truncates SERP titles based on pixel width (~580px), not character count. Wide characters like W or M get cut much earlier than narrow ones like i or l.
OG image validation rules differ between platforms — Facebook, LinkedIn, and Twitter/X each have different minimum dimension requirements.
summary and summary_large_image Twitter Card types have different image size requirements that I'm not handling.
I need this to run in Node.js / CI — no headless browser, no canvas, no DOM.
