nuxt-modules / og-image

Generate OG Images with Vue templates in Nuxt.
https://nuxtseo.com/og-image
415 stars 27 forks source link

fix!: new server routes `/__og-image__/image/<route>/og.png` #114

Closed harlan-zw closed 11 months ago

harlan-zw commented 11 months ago

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

: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