1.1.0 • Published 3 years ago
metas v1.1.0
Metas
Generate meta tags for HTML page
Install
npm install metasUsage
import metas from 'metas';
// get as HTML
metas({
title: "PAGE TITLE"
})
/* ->
<meta charset="utf-8"/>
<meta itemprop="name" content="PAGE TITLE"/>
<meta name="twitter:title" content="PAGE TITLE"/>
<meta name="og:title" content="PAGE TITLE"/>
*/
// get as Array
metas({
title: "PAGE TITLE"
}, true)
/* ->
[{
charset: 'utf-8'
}, {
itemprop: 'name',
content: 'TITLE'
}, {
name: 'twitter:title',
content: 'TITLE'
}, {
name: 'og:title',
content: 'TITLE'
}]
*/Options
metas( options = {}, returnArray = false );- Page infos
options.titlePage titleoptions.descriptionPage descriptionoptions.imagePreview imageoptions.videoMedia (Audio/Video) source urloptions.urlURL for the pageoptions.charsetcharset for the pageoptions.localeLocale name (eg. en_US)options.typePage type (eg. website, article...)
- Site infos
options.siteNameSite name
- For Twitter
options.twitter.cardTwitter card type (eg. summary, player)options.twitter.siteCreatorUsername of the site creator/administrator on Twitteroptions.twitter.authorUsername of the author for this page on Twitter
- For Facebook
options.facebook.adminsIdUser ID(s) of the site creator/administrator on Facebookoptions.facebook.appIdFacebook App ID