open-graph-meta
Generate Open Graph meta tags
Install
$ npm install --save open-graph-meta
Usage
var openGraphMeta = var openGraphTags = var data = title: 'The Title' image: url: 'image.jpg' //=> {'og:title': 'The Title', 'og:image:url': 'image.jpg'} //=> [{property: 'og:title', content: 'The Title'}, {property: 'og:image:url', content: 'image.jpg'}]
API
openGraphMeta(data)
-> object
data
Required
Type: object
An object with Open Graph data. The data can be nested. The final result will be flattened with a colon as the delimeter.
openGraphTags(data)
-> array[object]
data
Required
Type: object
An object with Open Graph data. The data is first passed through openGraphMeta
and then transformed into an array of {property, content}
meta objects.
License
MIT © Ben Drucker