Skip to content
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.

waigo/url-slash-seo

Repository files navigation

waigo-plugin-url-slash-sel

This waigo plugin provides:

urlSlashSeo

This middleware enhances your SEO by auto-redirecting the client to the correct version of a URL with or without an ending slash when the incorrect version is accessed.

If using this middleware then ensure you write your routes according to your chosen rule, i.e. with or without ending slashes.

Note that this middleware only intercepts GET and HEAD requests.

Installation

$ npm install waigo-plugin-url-slash-seo

Example

In your configuration file enable it as common middleware:

config.middleware.order = [
  'errorHandler',
  'staticResources',
  'urlSlashSeo',  // check now, before any more work is done
  'sessions',
  'outputFormats'
];

config.middleware.options.urlSlashSeo = {
  /* If false then correct URLs don't have a trailing slash. If true they do. */
  withSlash: false,
  /* If true then redirect with status code 301, else use 302 */
  permRedirect: true
};

License

MIT - see LICENSE.md

About

URL slash SEO middleware for Waigo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published