-
Notifications
You must be signed in to change notification settings - Fork 130
Pass parameters and anchors in URL to redirected page #229
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
base: master
Are you sure you want to change the base?
Conversation
|
Bump |
|
Bump2. Anyone checking this repo? |
|
Hello, this addition is rather useful. Can we get someone to merge it in? |
|
maybe @ashmaroli , @DirtyF , @parkr ? |
|
Can we bump this? @DirtyF I'll just tag you since it seems you've contributed recently. |
|
Hello everyone, I've taken a look at this. |
|
Thank you for taking a look @ashmaroli. This was months ago but if I remember right, it's because you want to be able to redirect to specific anchors on the permanent page, which happens dynamically. I don't think you can do it in Ruby (which runs at site build time) unless along with registering the redirect you somehow also registered all anchor and parameter possibilities. At least, I cannot think of a way. But I am no Ruby expert by far. If you have an idea, please let me know and I will be happy to try my hand at an alternative solution. If not, how do you propose increasing test coverage? The current test framework can only test Ruby code if I'm not mistaken. |
Oh right. There's no easy way to this before hand. |
|
Ref: #219 |
Co-authored-by: Stuart <[email protected]> Co-authored-by: Chris Buckley <[email protected]>
|
Nothing like a zombie PR! Just need maintainer approval 🤷 |
|
Hello @swheaton, I'll get back to this PR in the coming week. Would it be possible for you to update this branch in sync with the |
…pass-parameters-and-anchors
|
Now if you ask me anything substantial about this PR, I don't exactly remember because this was 4 years ago 😝 |
|
Hello again, @swheaton |
Summary
This change allows anchors (#heading) and parameters (?q=a) in a URL to be passed along to the redirected page. The use case for this would be when linking readers to a specific section of a page, and wanting the link to work for either the permalink page or the redirected page. I don't have a use case for query parameters, but it's the same idea so I don't see why not.
Current
If
oldPath/index.htmlredirects to
http://jekyllrb.com/2014/01/03/redirect-me-plz.htmlThen any link containing anchors or parameters is broken, such as the following:
http://jekyllrb.com/oldPath#important-subsection?question=answerWill redirect to the base page, stripping off the extras:
http://jekyllrb.com/2014/01/03/redirect-me-plz.htmlProposed
I propose that the link:
http://jekyllrb.com/oldPath#important-subsection?question=answerShould redirect to
http://jekyllrb.com/2014/01/03/redirect-me-plz.html#important-subsection?question=answerTechnical Details
location.hashandlocation.searchto the jump location.location.hashandlocation.search.