DEV Community

loading...
Cover image for Nuxtjs Generate SEO metadata simple

Nuxtjs Generate SEO metadata simple

ihavecoke profile image mixbo Updated on ・1 min read

when you use nuxtjs to support ssr, you can defined meta info in page vue component. and you should set metadata each page?

No! you can just add nuxt-seo-meta to your project.

i have made this npm to reduce time defined redundancy meta.

in nuxt-seo-meta you just defined you care info and reset all meta info nuxt-seo-meta will auto generate.
include twitter, facebook social meta.

here show the screenshoot for you

use in asyncData

async asyncData({ seoMeta }) {
  seoMeta({
    title: "PageTitle",
    description: "PageDescription",
    url: "PageUrl",
    image: 'SocialShareImage.png'
  })
}
Enter fullscreen mode Exit fullscreen mode

use in head

head({$seoMeta}){
  return {
   meta: $seoMeta({...options}, false)
  }
}

Enter fullscreen mode Exit fullscreen mode

DemoImage

you can find more info here

Discussion (0)

pic
Editor guide