You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: redirects drop the #fragment of the requested URL #78587
Astro's static redirects are meta-refresh pages, which do not carry the URL fragment across. Bookmarks to a section of a moved page land at the top of the new page instead of at the section.
How to reproduce
Open /gh-aw/workshop/#x. It redirects to /gh-aw/guides/workshop/ and the #x is gone.
Plan
Add a small Astro integration that runs after the build. For each redirect page whose meta refresh matches the configured redirect target, insert a short script before the meta refresh. The script moves the incoming location.hash onto the target.
If the redirect target already has its own fragment (for example /reference/connectors/#servicenow), keep the target's fragment.
Document the behaviour, and its limits, in docs/README.md. Without JavaScript the fragment is still lost, because the plain meta refresh is the fallback.
Done when
Browser tests on the built site pass:
/gh-aw/workshop/#x ends at /gh-aw/guides/workshop/#x;
/gh-aw/reference/servicenow-connector/#other ends at /gh-aw/reference/connectors/#servicenow.
docs/src/lib/redirect-fragments.js and its unit tests;
the hook in docs/astro.config.mjs;
the browser tests in section-sidebar.spec.ts;
the README section.
A working version of this fix is on my fork, in branch angelica/docs-playwright-fixes (all changes vs main). With all 10 commits applied, the full docs Playwright suite passes (239/239). Feel free to reuse the commit linked above, or to implement the plan differently.
Activity