Custom font for vercel/og plugin

I'm trying to port a api route from NextJS on Vercel to a function on pages and it uses custom fonts with vercel/og. Will the same code that works in Next work on a function?
const jakartaExtraBoldFont = fetch(new URL('../../../public/fonts/embed/PlusJakartaSans-ExtraBold.ttf', import.meta.url)).then((res) =>
res.arrayBuffer()
);
const jakartaMediumFont = fetch(new URL('../../../public/fonts/embed/PlusJakartaSans-Medium.ttf', import.meta.url)).then((res) => res.arrayBuffer());
const jakartaExtraBoldFont = fetch(new URL('../../../public/fonts/embed/PlusJakartaSans-ExtraBold.ttf', import.meta.url)).then((res) =>
res.arrayBuffer()
);
const jakartaMediumFont = fetch(new URL('../../../public/fonts/embed/PlusJakartaSans-Medium.ttf', import.meta.url)).then((res) => res.arrayBuffer());
https://developers.cloudflare.com/pages/platform/functions/plugins/vercel-og/
vercel/og · Cloudflare Pages docs
The @vercel/og Pages Plugin is a middleware which renders social images for webpages. It also includes an API to create arbitrary images.
1 Reply
Madrov
Madrov9mo ago
Did this work?
Want results from more Discord servers?
Add your server