Skip to content

Instantly share code, notes, and snippets.

@cjlaborde
Forked from garethredfern/getSiteMeta.js
Created February 15, 2021 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjlaborde/cf07a8fcbcf7cbede9455475bf2bb694 to your computer and use it in GitHub Desktop.
Save cjlaborde/cf07a8fcbcf7cbede9455475bf2bb694 to your computer and use it in GitHub Desktop.
The full getSiteMeta function for a Nuxt website, including social media and SEO tags.
const type = "website";
const url = "https://bobross.com";
const title = "My Amazing Blog on The Joy of Painting";
const description = "Articles focused on the beautiful art of landscape painting.";
const mainImage = "/a-lovely-image.png";
export default (meta) => {
return [
{
hid: "description",
name: "description",
content: (meta && meta.description) || description,
},
{
hid: "og:type",
property: "og:type",
content: (meta && meta.type) || type,
},
{
hid: "og:url",
property: "og:url",
content: (meta && meta.url) || url,
},
{
hid: "og:title",
property: "og:title",
content: (meta && meta.title) || title,
},
{
hid: "og:description",
property: "og:description",
content: (meta && meta.description) || description,
},
{
hid: "og:image",
property: "og:image",
content: (meta && meta.mainImage) || mainImage,
},
{
hid: "twitter:url",
name: "twitter:url",
content: (meta && meta.url) || url,
},
{
hid: "twitter:title",
name: "twitter:title",
content: (meta && meta.title) || title,
},
{
hid: "twitter:description",
name: "twitter:description",
content: (meta && meta.description) || description,
},
{
hid: "twitter:image",
name: "twitter:image",
content: (meta && meta.mainImage) || mainImage,
},
];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment