Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated gatsby-plugin-remove-trailing-slashes docs to include link re… #8720

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/gatsby-plugin-remove-trailing-slashes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
This plugin removes trailing slashes from your project's paths. For
example, `yoursite.com/about/` becomes `yoursite.com/about`.

## Important considerations
This plugin is intended to remove trailing slashes from paths generated by Gatsby itself.

This however does not prevent the resolution of pages that have trailing slashes, due to the way browsers are built to interpret URLs as paths.

This means that a user will need to take the extra step of ensuring that all router links direct towards paths that do not end in a slash.

For example, `<Link to="/about/">` will render the view related to `/about` but will display as `/about/` in the browsers address bar.

This is an important factor when relying on path driven logic, such as in the use case of the `Link` components `activeClassName` and `activeStyle` props.

For example, if the current route is `/about`, the component `<Link to="/about/" activeStyle={{ color: 'rebeccapurple' }}>` wouldn't match because of the slash.

## Usage

Install:
Expand Down