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

Override alias template to preserve anchor fragment #24394

Merged
merged 4 commits into from
Apr 28, 2023

Conversation

jolheiser
Copy link
Member

@jolheiser jolheiser commented Apr 28, 2023

This PR fixes an annoyance where docs aliases aren't preserving their anchor fragments.

The refactor included aliases to keep old links from dying, but currently they redirect without their anchor, which was used often to jump to sections.

This overrides the alias template with an alternative that preserves the anchor fragment.

To note, this is just a copy of the embedded template, but defaults to a JS redirect that preserves the anchor, and uses the meta tag as a fallback for noscript users.

I've also preserved query params, but I can remove that if we don't think it's necessary.

@jolheiser jolheiser added type/docs This PR mainly updates/creates documentation skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels Apr 28, 2023
@jolheiser jolheiser added this to the 1.20.0 milestone Apr 28, 2023
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 28, 2023
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 28, 2023
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 28, 2023
docs/layouts/alias.html Outdated Show resolved Hide resolved
Copy link
Member

@delvh delvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be best if this was fixed upstream, but while that's not done I'm fine with that workaround.

docs/layouts/alias.html Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 28, 2023
@jolheiser
Copy link
Member Author

I think it would be best if this was fixed upstream, but while that's not done I'm fine with that workaround.

I can take a look and propose it upstream as well. 👍
But this is currently happening, so would be good to merge for now either way.

@jolheiser jolheiser merged commit bc784a7 into go-gitea:main Apr 28, 2023
@jolheiser jolheiser deleted the alias-anchor branch May 2, 2023 15:30
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jul 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/docs This PR mainly updates/creates documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants