0.1.2 • Published 10 years ago
metalsmith-external-links v0.1.2
metalsmith-external-links
Processes HTML pages using Cheerio and modifies external facing link attributes.
Installation
$ npm install metalsmith-external-links --save-devJavascript 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