Skip to content

Conversation

@zoobestik
Copy link
Collaborator

@zoobestik zoobestik commented Dec 2, 2025

The main change is an improvement to how the script appends the current hash to the redirect URL, ensuring that any pre-existing hash in the target URL is properly replaced.

Wrong case:

/docs/js-hands-ons.html#test => /docs/js-overview.html#get-started-with-kotlin-js#test

Examples:

  1. Without hash in config

    - from: /docs/file.html
       to: github.com/...
     - /docs/file.html => github.com/...
     - /docs/file.html#anchor => github.com/...#anchor
  2. With hash in config

    - from: /docs/file.html
       to: github.com/...#new-anchor
     - /docs/file.html => `github.com/...#new-anchor`
     - /docs/file.html#anchor => github.com/...#anchor

Redirect logic improvements:

  • Updated the JavaScript redirect code to check for and remove any existing hash fragment from the url before appending the current window location hash. This ensures that only one hash is present in the final URL and prevents malformed redirects.
  • Replaced the previous inline script with a more robust and minified version, and wrapped the unminified version in a template comment for clarity and maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants