Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open graph dynamic image generation #6357

Merged
merged 9 commits into from
Mar 1, 2024
Merged

Open graph dynamic image generation #6357

merged 9 commits into from
Mar 1, 2024

Conversation

bmuenzenmeyer
Copy link
Collaborator

@bmuenzenmeyer bmuenzenmeyer commented Feb 24, 2024

Description

I've started dynamic open graph image generation.

This is still heavily WIP, and I need help landing it.

This process uses documentation found within https://vercel.com/docs/functions/og-image-generation#getting-started and multiple techniques from https://vercel.com/docs/functions/og-image-generation/og-image-examples combined.

Validation

http://localhost:3000/en/next-data/og?title=Announcing%20the%20new%20Node.js%20website&type=announcement

there are IMAGES! 😄

image
image
image

Related Issues

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npx turbo lint to ensure the code follows the style guide. And run npx turbo lint:fix to fix the style errors if necessary.
  • I have run npx turbo format to ensure the code follows the style guide.
  • I have run npx turbo test to check if all tests are passing.
  • I've covered new added functionality with unit tests if necessary.

Copy link

vercel bot commented Feb 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 1, 2024 3:43pm

Copy link
Collaborator Author

@bmuenzenmeyer bmuenzenmeyer left a comment

Choose a reason for hiding this comment

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

self-review

app/[locale]/og/route.tsx Outdated Show resolved Hide resolved
app/[locale]/og/route.tsx Outdated Show resolved Hide resolved
app/[locale]/og/route.tsx Outdated Show resolved Hide resolved
@ovflowd

This comment was marked as resolved.

@bmuenzenmeyer

This comment was marked as resolved.

@bmuenzenmeyer
Copy link
Collaborator Author

bmuenzenmeyer commented Feb 24, 2024

this now adds the following to every page

image

here's a comparison of post Preview and the og image

this isn't exact. I tried using bg-neutral-950 as the tw base and it broke. I might play with it, but welcome any TW-fu


image

do we want to constrict this to only blog posts? right now it's on every page

even regular pages

image

@bmuenzenmeyer bmuenzenmeyer added the github_actions:pull-request Trigger Pull Request Checks label Feb 24, 2024
@bmuenzenmeyer bmuenzenmeyer marked this pull request as ready for review February 24, 2024 22:01
@bmuenzenmeyer bmuenzenmeyer requested review from a team as code owners February 24, 2024 22:01
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Feb 24, 2024
@bmuenzenmeyer
Copy link
Collaborator Author

okay - this is good enough that I'd love a more thorough poke at it

Copy link

github-actions bot commented Feb 24, 2024

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟠 77 🟢 98 🟠 83 🟢 91 🔗
/en/about 🟢 100 🟢 91 🟠 83 🟠 83 🔗
/en/about/previous-releases 🟢 100 🟢 96 🟠 83 🟢 92 🔗
/en/download 🟢 99 🟢 97 🟠 83 🟢 91 🔗
/en/blog 🟢 97 🟢 96 🟠 83 🟢 92 🔗

Copy link

github-actions bot commented Feb 24, 2024

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 84%
80.18% (437/545) 79.09% (140/177) 73.07% (76/104)

Unit Test Report

Tests Skipped Failures Errors Time
88 0 💤 0 ❌ 0 🔥 4.426s ⏱️

@bmuenzenmeyer bmuenzenmeyer changed the title [WIP] open graph dynamic image generation Open graph dynamic image generation Feb 24, 2024
@bmuenzenmeyer

This comment was marked as resolved.

@ovflowd

This comment was marked as resolved.

@ovflowd
Copy link
Member

ovflowd commented Feb 25, 2024

FYI, this branch needs to be rebased

@bmuenzenmeyer
Copy link
Collaborator Author

bmuenzenmeyer commented Mar 1, 2024

@ovflowd i need guidance on if any of this is still feasible with static export

see https://github.com/nodejs/nodejs.org/actions/runs/8111322926/job/22170364122?pr=6357#step:10:34 - next wants me to statically generate every param - i suppose we have the blog data so it's possible???, but really starts to fight the framework for something that should be dynamic

@ovflowd
Copy link
Member

ovflowd commented Mar 1, 2024

@ovflowd i need guidance on if any of this is still feasible with static export

see nodejs/nodejs.org/actions/runs/8111322926/job/22170364122?pr=6357#step:10:34 - next wants me to statically generate every param - i suppose we have the blog data so it's possible???, but really starts to fight the framework for something that should be dynamic

No, generateStaticParams only means if you want to generate something statically. You don't need to provide any route. Let me make amends to this PR so that it works with the intended approach.

@bmuenzenmeyer bmuenzenmeyer added the github_actions:pull-request Trigger Pull Request Checks label Mar 1, 2024
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Mar 1, 2024
@ovflowd ovflowd added the github_actions:pull-request Trigger Pull Request Checks label Mar 1, 2024
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Mar 1, 2024
@ovflowd ovflowd merged commit dd4cadc into main Mar 1, 2024
22 of 23 checks passed
@ovflowd ovflowd deleted the og branch March 1, 2024 18:28
Copy link

sentry-io bot commented Mar 1, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TypeError: Cannot read properties of undefined (reading 'replace') hexToRGBA(util/hexToRGBA) View Issue

Did you find this useful? React with a 👍 or 👎

@ovflowd
Copy link
Member

ovflowd commented Mar 1, 2024

@bmuenzenmeyer can you make a hotfix?

@bmuenzenmeyer
Copy link
Collaborator Author

hotfixed via 604b4b4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants