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

fix(gatsby-plugin-page-creator): support index routes when using the File System Route API #31339

Merged
merged 2 commits into from
May 11, 2021

Conversation

angeloashmore
Copy link
Contributor

@angeloashmore angeloashmore commented May 8, 2021

Description

This PR adds root index URL support to the File System Route API.

Without the changes in this PR, the File System Route API behaves like the following example:

File name: {Model.path}.js
Model: { "path": "/" }
Resulting path: .js
Final URL: /.js

With the changes in this PR, the File System Route API behaves like the following example:

File name: {Model.path}.js
Model: { "path": "/" }
Resulting path: index.js
Final URL: /

The index => / transformation happens in gatsby-page-utils:

const parsedName = name === `index` ? `` : name

Documentation

Existing documentation: https://www.gatsbyjs.com/docs/reference/routing/file-system-route-api/

Updates to the documentation should not be necessary since this functionality should be a natural expectation.

Related Issues

Related Discussion: #26375 (comment)

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 8, 2021
@LekoArts LekoArts self-assigned this May 11, 2021
@LekoArts LekoArts added topic: page creation and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels May 11, 2021
Copy link
Contributor

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

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

Thanks!

@LekoArts LekoArts merged commit 6ad990c into gatsbyjs:master May 11, 2021
@LekoArts
Copy link
Contributor

This will be released as stable in 3.6.0 on 25th of May and automatically the next time gatsby@next is released

@angeloashmore
Copy link
Contributor Author

Thank you @LekoArts!

axe312ger pushed a commit that referenced this pull request May 20, 2021
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.

None yet

2 participants