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

Gatsby not creating page with filename "template-create" #27174

Closed
shripadk opened this issue Sep 29, 2020 · 2 comments
Closed

Gatsby not creating page with filename "template-create" #27174

shripadk opened this issue Sep 29, 2020 · 2 comments
Labels
type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@shripadk
Copy link

Description

Gatsby is not picking up a file with the name template-create in any folder/sub-folder within the src/pages directory. Works perfectly fine with other names.

Steps to reproduce

Create a template-create.js or template-create.tsx file anywhere in the src/pages directory and try navigating in the browser.

Have provided a minimal reproduction case here for anyone wanting to try: https://github.com/shripadk/test-repo

Expected result

Should render a page with "Hello World".

Actual result

Get a 404 instead.

This is with template-create.tsx file in src/pages ( https://localhost:8000/template-create )

template-create.tsx in src/pages

This is with template-create.js file in src/pages/admin ( https://localhost:8000/admin/template-create )

template-create.js in src/pages/admin

Environment

 ~/@/test-repo:master > gatsby info --clipboard

  System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
    Shell: 2.6.0 - /usr/local/bin/fish
  Binaries:
    Node: 10.18.1 - /usr/local/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 6.13.4 - /usr/local/bin/npm
  Languages:
    Python: 2.7.14 - /Users/shripadkrishna/.nix-profile/bin/python
  Browsers:
    Chrome: 85.0.4183.121
    Firefox: 74.0
    Safari: 14.0
  npmPackages:
    gatsby: ^2.24.66 => 2.24.66
    gatsby-image: ^2.4.20 => 2.4.20
    gatsby-plugin-manifest: ^2.4.32 => 2.4.32
    gatsby-plugin-offline: ^3.2.29 => 3.2.29
    gatsby-plugin-react-helmet: ^3.3.12 => 3.3.12
    gatsby-plugin-sharp: ^2.6.37 => 2.6.37
    gatsby-source-filesystem: ^2.3.31 => 2.3.31
    gatsby-transformer-sharp: ^2.5.16 => 2.5.16
@shripadk shripadk added the type: bug An issue or pull request relating to a bug in Gatsby label Sep 29, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 29, 2020
@LekoArts LekoArts added type: question or discussion Issue discussing or asking a question about Gatsby and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby labels Sep 30, 2020
@LekoArts
Copy link
Contributor

LekoArts commented Sep 30, 2020

Thank you for opening this!

This is expected behavior as Gatsby ignores files starting with template-. The previous behavior was added back in 2016 -- probably with the intention that people can store their templates in src/pages without creating pages for them.

Anyways, removing that behavior would be a breaking change so for now you'll need to rename your files if your intention for them is to be created :)

We're marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!

@shripadk
Copy link
Author

@LekoArts Thank you so much for the clarification. I did not know this as it wasn't documented anywhere. Makes complete sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants