https://github.com/gatsbyjs/gatsby/discussions/27582
The redirects generated by the gatsby-plugin-meta-redirect plugin do not remove the trailing slash. This causes any #anchor parameters to be stripped out of the link and most likely applies to query parameters as well.
#functions was removed from the URL and the page did not scroll down to that sectionWhen a user clicks on the link in the example above, they should land on the Functions section of the page.

Thanks @aswanson-nr . There are a lot of redirects on the site and a lot of anchor links, so a fix here will be very helpful!
from @zstix I believe those redirects come from https://www.gatsbyjs.com/docs/reference/config-files/actions/#createRedirect in Gatsby. Not sure if we have the option to pass along the extra URL params
Notes:
Not sure if this is an issue anymore, i've having trouble reproducing it.
https://docs.newrelic.com/docs/insights/new-relic-insights/using-new-relic-query-language/nrql-reference#functions
Redirects to
https://docs.newrelic.com/docs/query-your-data/nrql-new-relic-query-language/get-started/nrql-syntax-clauses-functions/
Example Anchors that redirect correctly:
Tested on Chrome/Firefox/Safari and all seem to be anchoring correctly
We netted out that this is still a problem in Sprint Planning today
@jpvajda it looks like we can't implement this easily since gatsby doesn't have support for this currently (see here).
is it cool if i close this ticket out?
I'm going to bump Gatsby about it, and try to get an ETA of when this may be available in Gatsby.
~Hey @jpvajda! We published today new release ([email protected]), I'm currently veryfying it and will open PR with bump if all things look good.~
Ops, sorry I was meant to respond to different issue - sorry for confussion
This may be a moot point now if the Gatsby update fixes this, but I figured out a workaround for this, i've got this working in develop build successfully, but for some reason it's not working in production, i'm confused about why these would work differently so it would be good to learn more about the redirection process.
Here's the branch with the changes I made: https://github.com/newrelic/docs-website/tree/ruairi/anchor-redirect
I used sessionStorage and a few of the Browser API's to achieve this.
Maybe it has something to do with the fact that it throws a 404 first in develop
Notes:
The Issue linked by Alec seems to be separate to this but does seem to be an issue: https://github.com/nsresulta/gatsby-plugin-meta-redirect/issues/11
I want to correct myself - I meant to write this to different (but still related to redirects) issue ( https://github.com/newrelic/docs-website/issues/1874 ). For forwarding query params and hash, we didn't implement that in Gatsby yet
no worries at all @pieh 馃樃
@rudouglas just to give you an update. had a quick chat with @roadlittledawn near the end of the day about this ticket just to get his thoughts, and he was thinking this might be difficult.
in particular, his question was how do we differentiate a hash in a url we know is a redirect versus a hash in a url from exploring a page, since not every hash needs to be carried forward to subsequent pages viewed.
so before you go too far, might double check that case.
@nr-kkenney ye I had considered that, I was storing the anchor, and then only applying it to the path if there wasn't already an anchor after the route change. So it was only catching instances where the anchor was being stripped. After more testing it doesn't look like this is going to be possible without an update on the Gatsby side to the createRedirect function.
I tested every Browser API available in Gatsby and none of them catch the anchor from the path before it redirects 馃槥
https://github.com/newrelic/docs-website/pull/2392
https://gatsbyjs-org-prefetched.netlify.app/docs/browser-apis
I think we should move this to blocked but lets chat and decide today
Our decision is to hold off on trying to solve this and wait for Gatsby to fix in place for it, I'll follow up with them on an ETA.
Adding to sprint 7 so I can follow up on this issue
waiting on confirmation from gatsby this fix has been released gatsbyjs/gatsby#27582