nuxt-modules / og-image

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

routeRules /** breaks nuxt-og-image #166

Open agotfredsen82 opened 4 months ago

agotfredsen82 commented 4 months ago

Hi. First of thank you for nuxt-og-image its great . Awesome work.

Here is a thing that took me a whole day to find after turning all code from nuxt-og-image inside out .

routeRules: { "/*": { swr: 60 4 }, }

breaks "/__og-image__/image/" ...

when running this routeRule as one might do on dynamic websites with cms

The rule /** overwrites __og-image__ and throws a strange $.fetch is not a function that got me down the totally wrong rabbit hole where __og-image__/image/ did not work at all.

so to fix this I had to skip /** but that forced me to add LOTS of routeRules for the whole site

routeRules: { "/about": { swr: 60 4 }, "/company": { swr: 60 4 }, etc etc etc }

so it would be awesome if

routeRules: { "/*": { swr: 60 4 }, }

could be used and that __og-image__ somehow is not affected by the "/*": { swr: 60 4 },

Best regards

harlan-zw commented 3 months ago

Hi, looks like an annoying one to debug. I'm not sure if there's anything I can do within the module to get this working, it's an upstream design issue with Nuxt / Nitro. I'll chat with the team next time I have a chance to try and come up with a solution.