Skip to content

Generate dynamic OG images for company profiles #2113

@dougaitken

Description

@dougaitken

Summary

Company profile pages currently use the generic site-wide OG image for social sharing. Blog posts already have dynamic per-post OG images generated via an SVG → JPEG pipeline. We should extend this to company profiles.

Current System (Blog Posts)

  1. src/common/og-images.njk generates an SVG per blog post using Eleventy pagination
  2. src/_config/events/svg-to-jpeg.js converts SVGs to JPEGs using Sharp (via @11ty/eleventy-img)
  3. JPEGs are committed to src/assets/og-images/ — the converter skips files that already exist
  4. Only runs in serve mode, not production builds

Considerations

  • 850+ company profiles — this is a much larger scale than ~10 blog posts
  • ~30MB of images in git if we commit them all (~35KB each) — not ideal
  • Build time — 850 extra SVG files generated per build adds overhead
  • Font dependency — the SVG-to-JPEG conversion requires fonts to be installed locally (Red Hat Display, Atkinson Hyperlegible)

Suggested Approach

Rather than committing images to the repo like blog posts do:

  1. Generate at deploy time — run the SVG-to-JPEG conversion in the eleventy.after event for production builds (not just serve mode), outputting directly to dist/
  2. Keep it simple — company name + remote policy/region on the branded background
  3. Cache on Netlify — use netlify-plugin-cache (already a dependency) to cache generated images between deploys so only new/changed companies trigger regeneration
  4. Incremental — skip conversion if the output file already exists (the current blog pipeline already does this)

This avoids bloating the git repo while still giving each company a unique social card.

Alternative

If deploy-time generation proves too slow or complex, an external OG image service (e.g. Vercel OG, Cloudinary) could generate images on-demand via URL parameters. This would add an external dependency but remove all build-time overhead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions