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

feat(gatsby): trailingSlash config option #34268

Merged
merged 76 commits into from
Jan 28, 2022
Merged

feat(gatsby): trailingSlash config option #34268

merged 76 commits into from
Jan 28, 2022

Conversation

LekoArts
Copy link
Contributor

@LekoArts LekoArts commented Dec 16, 2021

Description

Adds as per RFC the trailingSlash option to gatsby-config.js with the three main options:

  • always
  • never
  • ignore

For backwards compatibility reasons were' also adding (in v4) the legacy option that will be the default for v4. In v5 it'll be removed and always is the default. This is due to different behaviors across page creation where we can't just set it to always yet.

Documentation

The gatsby-config.js doc page was updated. Possibly other pages in the docs could be updated, too.

Related Issues

[ch42938]
[ch44034]
#34205
#31372

@LekoArts LekoArts added type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement. topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) labels Dec 16, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 16, 2021
@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 16, 2021
@Khaledgarbaya Khaledgarbaya added this to the Trailing Slash milestone Dec 17, 2021
…n functionality in gatsby-plugin-gatsby-cloud (#34526)
beforeEach(() => {
cy.visit(`/`).waitForRouteChange()
})
it(`page-creator without slash`, () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't feel strongly about this, so feel free to ignore it.

We could parameterize a large amount of these tests to clean them up a bit. Something like:

[
  {title: `page-creator without slash`, button: `page-creator-without`, expected: `/page-2/`},
  ...
].forEach({title, button, expected} => it(title, () => {
    cy.getTestElement(button).click()
    cy.waitForRouteChange().assertRoute(expected)
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that could be a good follow-up for some time

packages/gatsby-link/src/__tests__/is-local-link.js Outdated Show resolved Hide resolved
@@ -0,0 +1,21 @@
// TODO(v5): Remove legacy setting and default to "always"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a task/issue for all of these v5 TODOs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'll eventually look at those once v5 approaches

Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

🚢 🇮🇹

@LekoArts LekoArts merged commit d94c8e4 into master Jan 28, 2022
@LekoArts LekoArts deleted the trailing-slash branch January 28, 2022 14:59
pragmaticpat pushed a commit to pragmaticpat/gatsby that referenced this pull request Apr 28, 2022
Co-authored-by: Michal Piechowiak <[email protected]>
Co-authored-by: Jude Agboola <[email protected]>
Co-authored-by: Ty Hopp <[email protected]>
Co-authored-by: gatsbybot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants