simply-metadeprecated

A function to easily generate meta tag html.

Usage no npm install needed!

<script type="module">
  import simplyMeta from 'https://cdn.skypack.dev/simply-meta';
</script>

README

Simply Meta

Simply Meta allows for the quick addition of complex meta tags, including SEO tags, from an javascript object or JSON.

View all supported meta tags here

var simplyMeta = require('simply-meta');
return simplyMeta({
    charset: "utf-8",
    httpEquiv: {
        cacheControl: "Public"
    }
});

Outputs...

<meta data-sm="" charset="utf-8"><meta data-sm="" http-equiv="Cache-Control" content="Public">

Install

npm i -D simply-meta
yarn add -D simply-meta

Functions

var simplyMeta = require('simply-meta');

var meta = {
    charset: "utf-8",
    httpEquiv: {
        cacheControl: "Public"
    }
};
var options = {};

var metaHtml = simplyMeta(meta, options);
// returns the meta tags as html

var html = '<!DOCTYPE html><html><head></head><body></body></html>';
var metaHtmlAdded = simplyMeta.html(meta, html, options);
// returns the html with meta tags in the header

Options

var options = {
    disableHelper: true // disables the output of data-sm="" (use only if you are not reusing the html)
};