79496637

Date: 2025-03-09 21:45:54
Score: 0.5
Natty:
Report link

In case anyone runs into this issue. A viable workaround would be writing a custom HTML redirect file for sphinx-reredirects and including a script that captures the fragment and appends it to url.

For example:

<!DOCTYPE html>
<html>
  <head>
    <noscript>
      <meta http-equiv="refresh" content="0; url=${to_uri}" />
    </noscript>
    <script>
      var target = "${to_uri}";
      // If there's a URL hash, append it to the target URL
      if (window.location.hash) {
        window.location.replace(target + window.location.hash);
      } else {
        window.location.replace(target);
      }
    </script>
  </head>
</html>

Note that you have to register your custom redirect template in your conf.py.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: David Ekete