Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mattms/metah

HTML meta tag functions
https://github.com/mattms/metah

Last synced: about 1 month ago
JSON representation

HTML meta tag functions

Awesome Lists containing this project

README

        

# So metah!

Functions to create common HTML meta tags.

Requires [HyperScript](https://github.com/dominictarr/hyperscript) or similar API to create the tags.

## Usage

h = require('hyperscript')

meta = require('metah')(h)

console.log(meta.charset().outerHTML)
//

## Available tags

### author

meta.author('Matt McKellar-Spence')
//

### charset

meta.charset()
//

### description

meta.description('What it is all about')
//

### http_equiv

meta.http_equiv()
//

### link_css

meta.link_css('./style.css')
//

### link_script

meta.link_script('./script.js')
//

### script

#### Function input

function body_script () {
document.addEventListener('DOMContentLoaded', function (event) {
console.log('Ready.')
})
}

meta.script(body_script)

/*
(function () {
document.addEventListener('DOMContentLoaded', function (event) {
console.log('Ready.')
})
})()
*/

#### Text input

meta.script("document.addEventListener('DOMContentLoaded', function(event) {console.log('Ready.')})")
// document.addEventListener('DOMContentLoaded', function(event) {console.log('Ready.')})

### title

meta.title('My awesome site')
// My awesome site

### viewport

meta.viewport()
//