nuxt-modules / og-image

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

Breaks @nuxt/content with nuxt generate #68

Closed cossssmin closed 1 year ago

cossssmin commented 1 year ago

Describe the bug

Hi, thanks for this module, been enjoying it for some of our sites.

I'm trying to get it working for the Maizzle docs site, for which I also use @nuxt/content.

It works fine for all pages except the homepage.

The only things different there from other pages that I can think of:

You can see the current state of it in this PR (please excuse the diffs!), you can see index.vue uses defineOgImage above useContentHead:

https://github.com/maizzle/maizzle.com/pull/136

However, something in nuxt-og-image is tripping up @nuxt/content when I use nuxt generate (works fine when developing locally) - see the PR deployed on Netlify:

https://deploy-preview-136--maizzle-docs.netlify.app/

You can see the page is blank and there are console errors because those content json files were not generated (I've also double checked the build log, it's not even there).

The strange thing is, even if I remove all traces of nuxt-og-image from pages/index.vue, it keeps happening.

There are no build errors in the Netlify build log.

The moment I uninstall nuxt-og-image completely, it all works fine again.

Am I doing something wrong? Would appreciate any help, I'd really love to use the module for our docs :)

Reproduction

https://github.com/maizzle/maizzle.com/pull/136

System / Nuxt Info

------------------------------
- Operating System: Windows_NT
- Node Version:     v18.12.1
- Nuxt Version:     3.6.5
- Nitro Version:    2.5.2
- Package Manager:  npm@8.4.0
- Builder:          vite
- User Config:      content, css, experimental, modules, postcss, nitro, runtimeConfig, spaLoadingTemplate, typescript
- Runtime Modules:  nuxt-og-image@2.0.13, ./modules/routes-list, ./modules/docs-navigation, ./modules/github-release, ./modules/shiki/shiki-custom, @nuxt/content@2.7.2
- Build Modules:    -
------------------------------
cossssmin commented 1 year ago

Sorry for this, somehow my build command in Netlify had changed to npm run build, which obviously wouldn't work. Changed it to npm run generate and all is good now:

https://opengraph.dev/panel?url=https%3A%2F%2Fmaizzle.com

harlan-zw commented 1 year ago

Hey :) no problem at all, glad you could figure it out.

Nice site and og image by the way, do you mind if I put it as an example on https://nuxtseo.com/og-image/getting-started/examples ?

cossssmin commented 1 year ago

Thanks, and I’d love to see it there ;)