Skip to content

Instantly share code, notes, and snippets.

@devzom
Created March 5, 2022 09:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save devzom/a47b4119486ca2d60d36d9a96a2caa08 to your computer and use it in GitHub Desktop.
Nuxt: Add JSON-LD schema markup for SEO in Nuxt.js
data(){
return ({
description:'Description of the site'
})
}
head(){
return({
title: 'Home page',
meta: [
{
hid: 'description',
name: 'description',
content: `${this.description}`
}
],
script:[{
type:'application/ld+json',
json: {
'@context': 'http://schema.org',
'@type': <<Type gotten from Schema.org>>,
// Remaining properties
}
}]
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment