choo-meta

2.0.0 • Public • Published

choo-meta

npm version build status downloads style

Keeps document meta tags up to date. Drop-in replacement for choo native DOMTitleChange event.

Usage

Add the plugin as you would any other choo store.

var choo = require('choo')
var app = choo()
app.use(require('choo-meta')())
app.mount('body')

And switch out all your DOMTitleChange events for meta events with an object of meta properties to update. Will forward to DOMTitlteChange under the hood to preserve choo behaviour.

- emit('DOMTitleChange', 'My Website')
+ emit('meta', { title: 'My Website', 'og:image': '/logo.jpg' })

API

plugin = meta([opts])

Create a choo store which listens for the meta event. Will lookup meta tags in document head and update them in place, optionally adding new tags if not found.

Options

  • append (default: true) create and append new meta tags if they can't be found
  • origin webpage domain used for resolving relative urls and adding the og:url property

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i choo-meta

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

4.03 kB

Total Files

3

Last publish

Collaborators

  • tornqvist