nuxt-modules / og-image

Generate OG Images with Vue templates in Nuxt.
https://nuxtseo.com/og-image
MIT License
418 stars 29 forks source link

help: Questions about `defineOgImage()` #258

Closed XStarlink closed 2 months ago

XStarlink commented 3 months ago

📚 What are you trying to do?

Hello,

Thank you for the fantastic work on the SEO module!

I have three questions:

  1. When we use defineOgImage(), does it automatically pass the generated image to all og tags that expect an image, such as ogImage and twitterImage? (I couldn't find this information in the documentation, but it seems to work)

  2. Is ogImageSecureUrl useful for different platforms if my site is already using HTTPS? (considering that nowadays almost all sites use HTTPS). I didn't find options for defineOgImage() to set og:image:secure_url, but I'm not sure if it's really necessary...

  3. I couldn't find a way to prevent title and description from being set on certain pages where I use Nuxt Content because sometimes I don't want to pass the description in addition to the title as it would be too long. So, by not passing a description, it's still set by the module. Is it possible to have a setting like inheritMetaFromContent: false?

defineOgImage({
  component: 'Blog',
  props: {
    headline: t('case_studies.title'),
    title: post.value?.title,
    // description: post.value?.description,
    image: post.value?.image?.src
  }
})

As a bonus thought, I wonder if it would be beneficial to group all the keys from the various sub-modules under a seo object in nuxt.config.ts. This could be an opportunity for v2. I know many users only utilize certain sub-modules, but a consolidated seo object might help organize SEO-related configurations better. I just wanted to share this idea for discussion.

Your module is excellent! Thanks again for all your hard work!

harlan-zw commented 2 months ago

Hi, sorry for the delay.

To answer your questions:

  1. Yes, it should add tags for all social media sites.
  2. This should not be needed, i'm open to supporting it if someone has a valid use case though.
  3. You should be able to override the props on the markdown file itself, by providing a false it should override the value. Testing this I did find a bug so please use the latest.
---
ogImage:
   props:
      description: false
---

Thanks for the idea on the seo key, I think it's not a bad improvement for end users, however, it does add to my maintenance efforts and not exactly sure how the types would work, so not sure if it's worth it at this point.

Please feel free to submit any other ideas to the repo though.