The Wayback Machine - https://web.archive.org/web/20220415092823/https://github.com/gatsbyjs/gatsby/pull/34268
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

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.

  • gatsby-link support
  • Support in createPage calls (both page creator, FS route api & manual call)
  • Unit tests
  • Test Client-Only Pages
  • Test gatsbyPath of FS routes
  • E2E Tests
  • IPC messaging to Cloud => #34411
  • full develop support
  • #34526
  • #34529
  • #34547
  • #34538
  • #34554

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 topic: core labels Dec 16, 2021
@gatsbot gatsbot bot added the status: triage needed label Dec 16, 2021
@LekoArts LekoArts removed the status: triage needed 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

@j0sh77 j0sh77 Jan 27, 2022

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

@LekoArts LekoArts Jan 28, 2022

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

@j0sh77 j0sh77 Jan 27, 2022

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

@LekoArts LekoArts Jan 28, 2022

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

pieh
pieh approved these changes Jan 28, 2022
Copy link
Contributor

@pieh pieh left a comment

🚢 🇮🇹

@LekoArts LekoArts merged commit d94c8e4 into master Jan 28, 2022
31 checks passed
@LekoArts LekoArts deleted the trailing-slash branch Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: core type: feature or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants