Skip to content

Restore JPG image pipeline and render hero images#168

Open
alexwelcing wants to merge 1 commit intomainfrom
codex/generate-article-images-in-all-sizes-4vx1j8
Open

Restore JPG image pipeline and render hero images#168
alexwelcing wants to merge 1 commit intomainfrom
codex/generate-article-images-in-all-sizes-4vx1j8

Conversation

@alexwelcing
Copy link
Copy Markdown
Owner

Motivation

  • Restore the original JPG output for generated article art so pages can serve raster hero/OG images instead of SVGs.
  • Avoid committing binary artifacts by adding generated JPG paths to .gitignore so images can be produced locally/CI without checking them into git.
  • Keep article frontmatter and templates consistent so pages reference the expected /images/og/*.jpg and show hero images in the article layout.
  • Provide a deterministic generator that can still produce reproducible visual assets while keeping binaries out of the repo.

Description

  • Replaced SVG write logic with a sharp-based JPEG pipeline in scripts/generate-top-article-images.ts by adding sharp, renaming outputs to *.jpg, and using writeImage to emit JPEG files.
  • Updated article frontmatter across pages/docs/articles/*.mdx to point ogImage to /images/og/<slug>.jpg and removed the generated SVG assets from the repository.
  • Added public/images/articles/*.jpg and public/images/og/*.jpg entries to .gitignore to prevent committing generated binary images.
  • Render hero images in the article template by adding a heroImage prop and ArticleHeroImage element in pages/articles/[slug].tsx, and set heroImage: "/images/articles/${slug}.jpg" in getStaticProps.

Testing

  • Verified occurrences of .svg OG references with rg and replaced them via a scripted sed replacement, confirming frontmatter now references .jpg (succeeded).
  • Removed existing SVGs with rm -f public/images/articles/*.svg public/images/og/*.svg to ensure no stale SVG assets remain (succeeded).
  • Confirmed pages/articles/[slug].tsx compiles conceptually by adding the heroImage prop and template markup; no runtime asset generation was executed because generated JPGs are intentionally gitignored (image generator run not executed).
  • No other automated test suites were modified as part of this change and lint/build were not run in this rollout.

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
next-docs-search Error Error Mar 13, 2026 0:27am

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 758491d7f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pages/articles/[slug].tsx
description: data.description || '',
keywords: data.keywords || [],
ogImage: data.ogImage || '',
heroImage: `/images/articles/${slug}.jpg`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Gate hero image path on asset existence

getStaticProps now unconditionally sets heroImage to /images/articles/${slug}.jpg, which makes every article render a hero <img>. In this same change, generated JPGs are ignored in git and the build pipeline still does not run an image-generation step, so clean builds/deploys have no files in public/images/articles and all article pages emit 404 hero image requests with broken image UI; either generate these files during build or only pass heroImage when the file exists.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant