-
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
Add support for relative links with @reach/router #6945
Comments
@KyleAMathews is this issue fixed? |
@kakadiadarpan I just noticed this issue when upgrading from one of the beta releases to v2.0.6. |
No this is still a problem actually /cc @ryanflorence |
Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open! |
This issue is being closed due to inactivity. Is this a mistake? Please re-open this issue or create a new issue. |
This is still an issue. |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
Not exactly sure if this is on topic because the description is a little vague but... ✔️ I'm able to implement relative links if I use Link from 🐛 I'm unable to implement relative links when using Link from Links to code references related to my comments...
gatsby/packages/gatsby-link/src/index.js Lines 10 to 12 in e0db681
(updated: removed old references; added updated reference to withPrefix with commit hash blob instead of alias branched name)
|
This is still an issue. |
Is using |
Still an issue! |
Related: #14161 |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
@KyleAMathews, If this isn't something that can be fixed soon, could there at least be a sentence in the docs saying that relative links are not supported? Having ported over some code from @reach/router, I was completely mystified why relative links were not working. |
Just wasted an hour on this - a note in the doc would be much appreciated by the next N people who run into this.. |
@KyleAMathews @ascorbic Hey! I think this PR has broken the Link behaviour. I got something like that in a component: <Link to={post.fields.slug}>
{post.frontmatter.title}
</Link> This link is under the page Before it was rendered as (excepted result): <a href="/my-slug"> and now (wrong): <a href="/articles/my-slug"> I think many sites will be affected by this modification. How could we fix it? Thank you in advance |
@guillaumebriday I'm guessing the slug doesn't start with a slash? That means it's a relative link, so this is expected behaviour. Previously it would have given you a warning as it was unsupported, even if it happened to work. You can get the correct behaviour in your case by adding a slash to the start of the link. |
@ascorbic It doesn't. I use By default it does not prefix with a slash. I fixed it in https://github.com/guillaumebriday/guillaumebriday.fr/commit/36d1848f3fe931ce74dacdd83c451a9698542cce But I think there are plenty of applications with this behavior. Anyway, thanks for the help 🙏 |
I have 3-deep, 4-deep nested routes and need to relative on relative links to work. Per https://www.gatsbyjs.com/docs/gatsby-link/ I should be able to pass a slug Gatsby version: |
Currently this doesn't work due to how we render routes. This seems like something that can be fixed.
The text was updated successfully, but these errors were encountered: