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 title -
options.description
Page description -
options.image
Preview image -
options.video
Media (Audio/Video) source url -
options.url
URL for the page -
options.charset
charset for the page -
options.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 Twitter -
options.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 Facebook -
options.facebook.appId
Facebook App ID
-