Skip to content
Automatically links headed to an external destination.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
Readme.md
index.js
package.json

Readme.md

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

You can’t perform that action at this time.