1.2.0 • Published 6 years ago

metalsmith-canonical v1.2.0

Weekly downloads
68
License
ISC
Repository
github
Last release
6 years ago

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

1.2.0

6 years ago

1.1.2

6 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago