A metalsmith plugin to add a canonical url property to pages
$ npm i metalsmith-canonical --save
Configuration in metalsmith.json
:
{
"plugins": {
"metalsmith-canonical": {
"hostname": "http://www.website.com"
}
}
}
This plugin should be run after metalsmith-permalinks or metalsmith-moveup plugins.
You can pass options to metalsmith-canonical
with the Javascript API or CLI. The options are:
required
The hostname used for generating the canonical url.
optional
default: '**/*.html'
A multimatch pattern. Only for files that match this pattern a canonical url property will be added. Can be a string or an array of strings.
optional
default: false
Will replace any paths ending in index.html
with ''
. Useful when you're using metalsmith-permalinks.
optional
default: true
Will remove any trailing slashes.
ISC