jimporter / mike

Manage multiple versions of your MkDocs-powered documentation via Git
BSD 3-Clause "New" or "Revised" License
534 stars 47 forks source link

redirect from alias doesn't show version dropdown #96

Closed cchriste closed 2 years ago

cchriste commented 2 years ago

Using both GitHub deployment and test server, aliases don't show the dropdown to select a version, even with a browser refresh after the redirect.

Removing index.html from the forwarding links--specifically the <script> version--resolves this issue. This problem occurs when using Safari on OSX. No other browsers have been tried.

The alias's html looks like this:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Redirecting</title>
  <noscript>
    <meta http-equiv="refresh" content="1; url=../6.2/index.html" />
  </noscript>
  <script>
    window.location.replace("../6.2/index.html" + window.location.hash);   <!-- removing index.html here fixes forwarding -->
  </script>
</head>
<body>
  Redirecting to <a href="../6.2/index.html">../6.2/index.html</a>...
</body>
</html>
jimporter commented 2 years ago

Ok, this should be fixed. The JS to extract the version from the URL is a bit more robust now.