/metalsmith-canonical

A metalsmith plugin to add a canonical url property to pages

Primary LanguageJavaScript

metalsmith-canonical

npm version Build Status

A metalsmith plugin to add a canonical url property to pages

Installation

$ npm i metalsmith-canonical --save

Example

Configuration in metalsmith.json:

{
  "plugins": {
    "metalsmith-canonical": {
      "hostname": "http://www.website.com"
    }
  }
}

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.

License

ISC