Currently, the signature of an OG image URL is /<route>/__og_image__/og.png. This works correctly but it means we can't target these routes using route rules, as they would need to start with a wildcard, which isn't supported (https://github.com/unjs/radix3/issues/68).
This PR changes the route signature to /__og-image__/image/<route>/og.png, as well as moving the non-PNG routes away from the /api prefix and making them easier to access. They are only used for DevTools and debugging with this update as we a
:warning: This is a breaking change for the DevTools and anyone using the routes directly.
etc.
In this we also avoid doing nested Nitro calls as they can mess up the request origin. The only exception is the HTML extraction of the route so we can resolve the options. We will handle this better using unstorage in a subsequent PR.
Description
Currently, the signature of an OG image URL is
/<route>/__og_image__/og.png
. This works correctly but it means we can't target these routes using route rules, as they would need to start with a wildcard, which isn't supported (https://github.com/unjs/radix3/issues/68).This PR changes the route signature to
/__og-image__/image/<route>/og.png
, as well as moving the non-PNG routes away from the/api
prefix and making them easier to access. They are only used for DevTools and debugging with this update as we a/api/og-image-svg
->/__og-image__/image/<route>/og.svg
/api/og-image-options
->/__og-image__/image/<route>/og.json
/api/og-image-font
->/__og-image__/font
:warning: This is a breaking change for the DevTools and anyone using the routes directly.
etc.
In this we also avoid doing nested Nitro calls as they can mess up the request origin. The only exception is the HTML extraction of the route so we can resolve the options. We will handle this better using unstorage in a subsequent PR.
Linked Issues
https://github.com/harlan-zw/nuxt-og-image/issues/101
Additional context