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

Documentation fix: Execute trailing slash stripping function, rather than assign it. #9924

Merged
merged 3 commits into from
Nov 29, 2018

Conversation

stevetweeddale
Copy link
Contributor

The trailing slash stripping plugin executes the function rather than just assigning it, so I'd imagine that's what the example code should be doing too.

@stevetweeddale stevetweeddale requested a review from a team November 14, 2018 15:56
Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment!

@@ -121,7 +121,7 @@ exports.onCreatePage = ({ page, actions }) => {
return new Promise(resolve => {
const oldPage = Object.assign({}, page)
// Remove trailing slash unless page is /
page.path = _path => (_path === `/` ? _path : _path.replace(/\/$/, ``))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to go this route, why not create a function (e.g. const replacePath = _path => // yadda yadda) and then use it like the link you provide? That seems much clearer!

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely, I guess I just went for the single line change for the sake of keeping it to one line! PR updated

Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; thank you!

@DSchau DSchau merged commit 994ac97 into gatsbyjs:master Nov 29, 2018
@gatsbot
Copy link

gatsbot bot commented Nov 29, 2018

Holy buckets, @stevetweeddale — we just merged your PR to Gatsby! 💪💜

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (Currently we’ve got a couple t-shirts available, plus some socks that are really razzing our berries right now.)
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again!

gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
…than assign it. (gatsbyjs#9924)

The trailing slash stripping plugin [executes the function](https://github.com/gatsbyjs/gatsby/blob/f9714a5646523bc728586e3692190507ad68e6c1/packages/gatsby-plugin-remove-trailing-slashes/src/gatsby-node.js#L9) rather than just assigning it, so I'd imagine that's what the example code should be doing too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants