-
Notifications
You must be signed in to change notification settings - Fork 53
Add dynamic OG generation #483
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
base: main
Are you sure you want to change the base?
Conversation
commit: |
9a9b1e8
to
31b1f2e
Compare
ee44edb
to
018a1eb
Compare
1591230
to
4ba210c
Compare
alchemy-web/alchemy.run.ts
Outdated
export const ogWorker = await Worker("alchemy-og-worker", { | ||
entrypoint: "./src/og-worker.ts", | ||
routes: [ | ||
{ | ||
pattern: "og.alchemy.run/*", | ||
}, | ||
], | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @sam-goodwin would be good for you to review this specifically
🚀 Website Preview DeployedYour website preview is ready! Preview URL: https://2a6ae632-alchemy-website.alchemy-run.workers.dev This preview was built from commit 4643378 🤖 This comment will be updated automatically when you push new commits to this PR. |
} | ||
|
||
// Base OG image URL | ||
const baseImageUrl = `/og/${route.id ?? "index"}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here needs to be updated. This shouldn't be /og/
it should be something more like og.alchemy.run/...
. I don't exactly know how best to get the domain though. @sam-goodwin this is what I was talking about when mentioning it'd be nice to have a config output that didn't require deployment. It's a bit of a chicken and egg situation because you need the config to be able to deploy but you can only get it by doing the deploy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a subdomain for og images instead of generating at build time?
Okay, here's what's left:
|
Adds an
/og
route that will render an og card for any given page./og
will render the default,/og/getting-started
will render for the getting started page, etc. There's a secondary worker that I've added that runsworkers-og
atog.alchemy.run
to render out the actual og image. This theoretically would be a good candidate to get swapped out for a container and just run playwright to snapshot it when needed.