Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saintedlama/metalsmith-canonical
A metalsmith plugin to add a canonical url property to pages
https://github.com/saintedlama/metalsmith-canonical
Last synced: 2 months ago
JSON representation
A metalsmith plugin to add a canonical url property to pages
- Host: GitHub
- URL: https://github.com/saintedlama/metalsmith-canonical
- Owner: saintedlama
- License: isc
- Created: 2016-12-21T16:12:42.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-09-06T07:24:32.000Z (4 months ago)
- Last Synced: 2024-09-25T12:26:40.963Z (3 months ago)
- Language: JavaScript
- Size: 289 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# metalsmith-canonical
[![npm version][npm-badge]][npm-url]
[![Build Status][travis-badge]][travis-url]A metalsmith plugin to add a canonical url property to pages
## Installation
```bash
$ npm i metalsmith-canonical --save
```## Example
Configuration in `metalsmith.json`:
```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](https://github.com/segmentio/metalsmith#api) or [CLI](https://github.com/segmentio/metalsmith#cli). The options are:
### hostname
* `required`
The hostname used for generating the canonical url.
### pattern
* `optional`
* `default: '**/*.html'`A [multimatch](https://github.com/sindresorhus/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](https://github.com/segmentio/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
[npm-badge]: https://img.shields.io/npm/v/metalsmith-canonical.svg
[npm-url]: https://www.npmjs.com/package/metalsmith-canonical[travis-badge]: https://travis-ci.org/saintedlama/metalsmith-canonical.svg?branch=master
[travis-url]: https://travis-ci.org/saintedlama/metalsmith-canonical