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
Implement basic 301 Redirect for DSpace 6.x URLs when SSR is used. #2331
Conversation
@artlowel : Wondering if you or someone on your team could glance at this? I was looking into fixing this SEO issue after talking to Google Scholar today, and this is a "basic fix" (may not be perfect, but it works). Not sure whether to go down this path for 7.6, or just press pause and work on a better fix for a later release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tdonohue!
This works. However I think the cleaner way to do it would be to use HardRedirectService for this. Its purpose is to handle redirects, and it already has separate implementations on the browser and server so you wouldn't need the platform check in DsoRedirectService
It would be slightly more complicated though, as we'd need the option to pass a 3xx status code as a param to HardRedirectService's redirect method (as currently it always redirects with a 302)
So if we still want to include this fix in 7.6 I'd use this PR. If it's not that urgent, perhaps wait for a PR based on HardRedirectService
…pport optional statusCode
@artlowel : I quickly refactored this to just use the HardRedirectService (adding an optional statusCode param). This is still working well for me. Could you give it a quick test / review tomorrow? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tdonohue!
References
Description
Minor changes to the
dso-redirect.service.ts
to ensure it returns a301 Moved Permanently
redirect when running during server side rendering (SSR). This required changes to the existing HardRedirectService to support 301 redirects.Added specs for all changes as well.
Instructions for Reviewers
/handle/[prefix]/[suffix]
paths to an existing Community, Collection or Item.