0.1.1 • Published 6 years ago

shopback-html-seo v0.1.1

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

Install

npm install shopback-html-seo

Demo

npm install
npm test

Usage

const shopbackHtmlSEO = require('shopback-html-seo')
shopbackHtmlSEO(options)

Stream

const {htmlTransformer} = require('./htmlTransformer');
const rs = fs.createReadStream(options.input)
            .pipe(new htmlTransformer(rules, print));

Configure

Config file is in ./config.js, It defines HTML file source, output file name, and search rules.

{
    input: 'test.html', // file source path
    output: 'test.txt', // result output path
    print: true,

    rules: [
        {tag: 'img', attr: {name: 'alt'}},
        {tag: 'a', attr: {name: 'rel'}},
        {tag: 'video'},
        {tag: 'h2', limit: {type: 'upper', count: 2}},
        {tag: 'meta', attr: {name: 'property', value: 'og:url'}},
        {tag: 'meta', attr: {name: 'name', value: 'robots'}}
    ]
};