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

Preserve fragment and query string in redirect #123

Closed
FokkeZB opened this issue Oct 13, 2016 · 6 comments
Closed

Preserve fragment and query string in redirect #123

FokkeZB opened this issue Oct 13, 2016 · 6 comments

Comments

@FokkeZB
Copy link

FokkeZB commented Oct 13, 2016

If I have a redirect from /foo to /bar and I go to /foo?alpha=beta#omega then the query string and fragment are not preserved.

This can only be done in JavaScript of course, so it would requite https://github.com/jekyll/jekyll-redirect-from/blob/master/lib/jekyll-redirect-from/redirect_page.rb#L37 to update (or write?) the meta tag and update the link.

@samba
Copy link

samba commented Nov 17, 2016

👍 , this is an important detail for users of third-party analytics tools (e.g. Google Analytics).

My Ruby is not strong, so I've attempted a patched HTML template only:
https://gist.github.com/samba/01c4a07ab73d1bacd23a9f3115e8978c

FokkeZB added a commit to FokkeZB/jekyll-redirect-from that referenced this issue Nov 18, 2016
@FokkeZB
Copy link
Author

FokkeZB commented Nov 18, 2016

Thanks @samba, I turned it into a PR with some further edits: #127

@jekyllbot
Copy link
Contributor

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

@FokkeZB
Copy link
Author

FokkeZB commented Jan 18, 2017

Thanks @jekyllbot, however there's already a PR waiting to close this issue:

#127

@mpchadwick
Copy link

FYI for anyone else who lands on this, I wrote a blog post with a workaround here https://maxchadwick.xyz/blog/preserving-the-hash-and-query-string-with-jekyll-redirects

tl;dr; If you want this behavior just commit the HTML redirect file to your repo with the required JavaScript.

@pathawks based on your latest comment maybe this issue should be closed?

@pathawks
Copy link
Member

@mpchadwick Yes, I suppose you are right.

Thank you for posting your workaround! Users should be able to implement that behavior if they need it. However, I feel this plugin should be focused on keeping things as simple as possible, and this feature is not a good fit at this time.

@jekyll jekyll locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants