metas
v1.1.0
Published
Generate meta tags for HTML page
Downloads
13
Readme
Metas
Generate meta tags for HTML page
Install
npm install metas
Usage
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.title
Page titleoptions.description
Page descriptionoptions.image
Preview imageoptions.video
Media (Audio/Video) source urloptions.url
URL for the pageoptions.charset
charset for the pageoptions.locale
Locale name (eg. en_US)options.type
Page type (eg. website, article...)
- Site infos
options.siteName
Site name
- For Twitter
options.twitter.card
Twitter card type (eg. summary, player)options.twitter.siteCreator
Username of the site creator/administrator on Twitteroptions.twitter.author
Username of the author for this page on Twitter
- For Facebook
options.facebook.adminsId
User ID(s) of the site creator/administrator on Facebookoptions.facebook.appId
Facebook App ID