Skip to content

Instantly share code, notes, and snippets.

@allanwhite
Last active May 6, 2024 05:18
Show Gist options
  • Save allanwhite/6576218 to your computer and use it in GitHub Desktop.
Save allanwhite/6576218 to your computer and use it in GitHub Desktop.
A Jade snippet for spitting out Open Graph meta tags based on a simple array. Note: various social networks have different requirements about images, etc.
- var site = {title: 'site name', url: 'http:site.com', image: '/images/thumbnail-site-square.jpg', favicon: '/favicon.ico', description: 'Site Description'}
each val, key in site // Open Graph metadata
meta(property='og:'+'#{key}', content='#{val}')
@pateljatin
Copy link

Thanks - this is great stuff!

@joselazovargas
Copy link

Hi, I just tried to compile your snippet but it keeps showing errors, have you updated to work with pug?

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