-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Path prefix does not work when page URL starts with path prefix #27604
Comments
I am interested. Can anyone help me regarding this? |
Thanks for the detailed report. This seems to be because we're calling |
@ascorbic Thank you so much!! I'll try my best to fix this! |
@ascorbic seems like I've found the bug can you please review it 😃 |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hi, thanks a lot of updates @ascorbic, @im-adithya and @Kumail786, we appreciate it! We are still having this issue on our end and it stops us from progressing. So the issue is not stale. Any updates on when this could be fixed? So far, I see one commit (Kumail786@4c05192) and one pull request (#27621) addressing this, but the pull request has broken tests. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Thanks again for being part of the Gatsby community! 💪💜 |
I stumbled upon this and spend few hours investigating problem. Let's analyze this bug for my case:
As a result |
Hi there... It has been 3 years since this BUG was recently commented and it is still not fixed. I have exactly the same problem... I think I know what is the root cause... In loadPage method gatsby/packages/gatsby/cache-dir/loader.js Line 211 in 54d4721
you call findPath which internally strip the path prefix once. Lower in the same method you call loadPageDataJson passing already trimmed path ( Unfortunately it looks like that this issue is even more complex. Similar duplication still exists in doPrefetch logic as @koxu1996 mentioned above. |
@sidharthachatterjee, @wardpeet I see that you were involved in |
Description
Path prefix (https://www.gatsbyjs.com/docs/path-prefix/) does not work when page URL starts with path prefix. For example, if path prefix is
/blog
and page's URL isblog
, navigating to/blog/blog
does not work.This can be demonstrated in:
https://gatsby-path-prefix-bug.netlify.app/blog/blog/
(page works with Javascript disabled, but not with Javascript enabled)
Working example of path prefix can be found in:
https://gatsby-path-prefix-bug.netlify.app/blog/
Steps to reproduce
npx gatsby new gatsby-path-prefix-bug https://github.com/gatsbyjs/gatsby-starter-hello-world
cd gatsby-path-prefix-bug
cp src/pages/index.js src/pages/blog.js
gatsby-config.js
to containmodule.exports = { pathPrefix: "/blog" }
npx gatsby build --prefix-paths && npx gatsby serve --prefix-paths
Expected result
"Hello world!" text should be seen
Actual result
"Hello world!" text is seen for a while and then a blank page is seen
Environment
System:
OS: Windows 10 10.0.19041
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Binaries:
Node: 12.16.3 - C:\Program Files\nodejs\node.EXE
npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 3.8.3 - C:\Python38\python.EXE
Browsers:
Chrome: 86.0.4240.75
Edge: Spartan (44.19041.423.0), Chromium (86.0.622.48)
npmPackages:
gatsby: ^2.24.79 => 2.24.79
The text was updated successfully, but these errors were encountered: