Adds 'path' property to each file's metadata, which can be used as a URL.
$ npm install metalsmith-path
Install via npm and then add the metalsmith-path
key to your metalsmith.json
plugins, like so:
{
"plugins": {
"metalsmith-path": true
}
}
Pass the plugin to Metalsmith#use
:
var path = require('metalsmith-path');
metalsmith.use(path({ /* options */ }));
The name of the property (key) where the path will be stored. Default: path
.
The base directory of the site, useful for generating absolute paths. Default: empty.
Example:
metalsmith.use(path({ baseDirectory : "/" }));
If a directoryIndex is supplied, it will be stripped from the path. Default: disabled.
metalsmith.use(path({ directoryIndex : "index.html" }));
This creates URLs such as /blog/
instead of /blog/index.html
.
WTFPL