metalsmith-canonical
A metalsmith plugin to add a canonical url property to pages
Installation
$ npm i metalsmith-canonical --save
Example
Configuration in metalsmith.json
:
This plugin should be run after metalsmith-permalinks or metalsmith-moveup plugins.
Options
You can pass options to metalsmith-canonical
with the Javascript API or CLI. The options are:
hostname
required
The hostname used for generating the canonical url.
pattern
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.
omitIndex
optional
default: false
Will replace any paths ending in index.html
with ''
. Useful when you're using metalsmith-permalinks.
omitTrailingSlashes
optional
default: true
Will remove any trailing slashes.
omitExtensions
optional
default: undefined
example: ['.html', '.htm']
Will remove any extensions at the ends of files.
E.g., .../abc.html
becomes .../abc
.
License
ISC