diff --git a/site/public/og-default.png b/site/public/og-default.png new file mode 100644 index 00000000..418c4cd2 Binary files /dev/null and b/site/public/og-default.png differ diff --git a/site/scripts/generate-og-default.mjs b/site/scripts/generate-og-default.mjs new file mode 100644 index 00000000..d3087bfc --- /dev/null +++ b/site/scripts/generate-og-default.mjs @@ -0,0 +1,62 @@ +/** + * Generates the default OG image: Video.js mono logo in manila on a dark background. + * + * Usage: node scripts/generate-og-default.mjs + * Output: public/og-default.png (1200×630) + */ + +import { readFileSync } from 'node:fs'; +import { dirname, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import sharp from 'sharp'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +const BACKGROUND = '#1e1d1d'; // faded-black (dark mode bg) +const LOGO_FILL = '#f3e7d2'; // manila-light +const WIDTH = 1200; +const HEIGHT = 630; + +// Read the mono logo SVG and replace currentColor with manila +const logoSvg = readFileSync(resolve(__dirname, '../src/assets/logos/videojs-mono.svg'), 'utf-8'); + +// The logo viewBox is 0 0 381 68 → aspect ratio ~5.6:1 +const logoNativeW = 381; +const logoNativeH = 68; +const logoAspect = logoNativeW / logoNativeH; + +// ~80% of image width +const logoW = Math.round(WIDTH * 0.8); +const logoH = Math.round(logoW / logoAspect); + +// Prepare the logo SVG at the target size with manila fill +const coloredLogo = logoSvg + .replace(/currentColor/g, LOGO_FILL) + .replace(/ - {image && } + {/* Twitter */} @@ -123,14 +127,12 @@ const fullTitle = /> - { - resolvedTwitterImage && ( - - ) - } + {/* Whatever else */}