Skip to content

Instantly share code, notes, and snippets.

@MartinMuzatko
Last active April 27, 2024 05:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinMuzatko/cc86b3f168630c05978d65c36169b129 to your computer and use it in GitHub Desktop.
Save MartinMuzatko/cc86b3f168630c05978d65c36169b129 to your computer and use it in GitHub Desktop.
Vuepress open graph metadata
let ogprefix = 'og: http://ogp.me/ns#'
let title = 'Wire Up Your Front-End'
let description = 'Get your personal guide to finally piece together the missing puzzles to communicate with your server'
let color = '#f42525'
let author = 'Martin Muzatko'
module.exports = {
title,
description,
serviceWorker: true,
head: [
['link', { rel: 'icon', href: `/assets/favicon.ico` }],
['meta', { name: 'theme-color', content: color }],
['meta', { prefix: ogprefix, property: 'og:title', content: title }],
['meta', { prefix: ogprefix, property: 'twitter:title', content: title }],
['meta', { prefix: ogprefix, property: 'og:type', content: 'article' }],
['meta', { prefix: ogprefix, property: 'og:url', content: 'https://wireupyourfrontend.com' }],
['meta', { prefix: ogprefix, property: 'og:description', content: description }],
['meta', { prefix: ogprefix, property: 'og:image', content: 'https://wireupyourfrontend.com/assets/logo.png' }],
['meta', { prefix: ogprefix, property: 'og:article:author', content: author }],
['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],
['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }],
['link', { rel: 'apple-touch-icon', href: `/assets/apple-touch-icon.png` }],
['link', { rel: 'mask-icon', href: '/assets/safari-pinned-tab.svg', color: color }],
['meta', { name: 'msapplication-TileImage', content: '/assets/mstile-150x150.png' }],
['meta', { name: 'msapplication-TileColor', content: color }],
],
@davestewart
Copy link

davestewart commented Mar 12, 2021

Hey Martin, thanks for this.

BTW, I use helper functions (which you could adapt) to make this stuff neater:

function meta (name, content, props = {}) {
  return ['meta', { name, content, ...props }]
}

function link (rel, href) {
  return ['link', { rel, href }]
}

@CodyBontecou
Copy link

Is there a way to place meta data on individual pages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment