hellosendpie
hellosendpie
Explore posts from servers
CDCloudflare Developers
Created by hellosendpie on 5/28/2024 in #pages-help
OG Image Generation Help | Workers + R2
Hello Folks! Framework: Hugo + Nodejs Scripts I want to dynamically generate my OG images, based on whether the "og:image" url returns a 404 or not. Ideal flow: If it returns a 404, just send that url to a worker, where I can catch this url and accordingly update my r2 bucket with the respective picture needed for that route. Reasoning: - I already locally run a script that generates Og images using puppeteer, wouldn't mind pushing it to another worker friendly approach - I don't want to pre-generate these at build time, I want to save resources and statically have the links coded into my html, but only render them in r2 when a request to the static og image link returns a 404 - I don't want to parse every single request through a worker, if the file is generated, just serve it via the cdn link I've already explicitly coded in. Aka, all og image links already prefix url route with example.com/og/ folder for ease in lookup. Any help will be appreciated!
1 replies