metalsmith-external-links

0.1.2 • Public • Published

metalsmith-external-links

Processes HTML pages using Cheerio and modifies external facing link attributes.

Installation

$ npm install metalsmith-external-links --save-dev

Javascript Usage

Pass with options to Metalsmith#use:

var extlinks = require('metalsmith-external-links');
 
metalsmith.use(extlinks({
  domain: 'google.com'
  whitelist: [],
  rel: 'external',
  target: '_blank',
  extClass: 'external'
}));

Options

There are a couple options available to make external links more useful.

domain (required)

A string containing the domain name (name.ca) without protocol and www. Example: npmjs.com.

whitelist <String/Array>

A glob string or list of glob strings used to match urls.

rel

String used to change element rel attribute, leaves rel unchanged if set to undefined.

target

String used to change element target attribute, leaves target unchanged if set to undefined.

extClass

Class added to element when it's external, will leave class unchanged if set to undefined.

License

MIT

/metalsmith-external-links/

    Package Sidebar

    Install

    npm i metalsmith-external-links

    Weekly Downloads

    1

    Version

    0.1.2

    License

    MIT

    Last publish

    Collaborators

    • krambuhl