2.3.1 • Published 3 years ago

nuxt-seo-meta v2.3.1

Weekly downloads
15
License
MIT
Repository
github
Last release
3 years ago

nuxt-seo-meta

Support Nuxt generate SEO metadata easy

Install

yarn add nuxt-seo-meta

//or npm
npm add nuxt-seo-meta

Add a config to nuxt.config.js file.

{
  ... your options
  modules: [
    'nuxt-seo-meta',
  ],
  seoMeta: {
    title: 'SEO Meta Demo',
    description: 'SEO Description'
  }
}

use $seoMeta method in nuxtjs context, general we can use at aysncData hooks

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

use in head options in page component

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

if you call $seoMeta in page head method you need assign the return value to meta options and pass the second args to false

the $seoMeta method support only return generate metadata if you pass false to the second argument.

the false options will not inject the metadata to html head tag, only will return the generate data to you

That all. you can inspect you page in Chrome developer tools

Here show the demo screenshot.

DemoImage

Options

Below options all effect html head meta tag

optionstypedescription
titlestringany thing you want to set to meta
descriptionstringany thing you want to set to meta
defaultDescriptionstringdefault description to you each page
urlstringcurrent page url or other you want to share with others
defaultUrlstringdefault image when your page not present images
imagestringcurrent page share image url
defaultImagestringdefault current page share image url
localestringcurrent page locale, this option just present in og
siteNamestringyou web app name, this option just present in og
twitterUserstringyou can share page to twitter with creator user
ignoreTwitterbooleandisable twitter seo metadata
ignoreOGbooleandisable OG seo metadata
2.3.0

3 years ago

2.3.1

3 years ago

2.2.0

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago