metalsmith-canonical

1.2.0 • Public • Published

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.

omitExtensions

  • optional
  • default: undefined
  • example: ['.html', '.htm']

Will remove any extensions at the ends of files. E.g., .../abc.html becomes .../abc.

License

ISC

Package Sidebar

Install

npm i metalsmith-canonical

Weekly Downloads

11

Version

1.2.0

License

ISC

Unpacked Size

12 kB

Total Files

9

Last publish

Collaborators

  • saintedlama