nickfrosty / nuxt-seo

SEO / HTML meta tags module for NuxtJS
https://www.npmjs.com/package/nuxt-seo
MIT License
18 stars 6 forks source link

How to merge default options with head function options in nuxt.config.js file #15

Open abdulhadi-lababidi opened 1 year ago

abdulhadi-lababidi commented 1 year ago

I'm trying to use nuxt-seo module but it's not working for some reason

nuxt.config.js

{
    head(){
           return {
                  script: [...someGlobalScripts]
           }
    },
    seo:{
          title: 'my website title'
    }
}

When i commented the head function it worked fine, so i think the return of head function is overriding the global config from nuxt-seo module Any thoughts?

abdulhadi-lababidi commented 1 year ago

after further debugging, the plugin will not work even if you use it inside components in case you used head function instead of head object inside nuxt.config.js file

The plugin assumes that the head is always an object, what a waste of time!

image