404.rst 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. :github_url: hide
  2. :allow_comments: False
  3. Page not found
  4. ==============
  5. .. https://github.com/readthedocs/sphinx-notfound-page
  6. .. raw:: html
  7. <p>
  8. Sorry, we couldn't find that page. It may have been renamed or removed
  9. in the version of the documentation you're currently browsing.
  10. </p>
  11. <p>
  12. If you're currently browsing the
  13. <em>latest</em> version of the documentation, try browsing the
  14. <a href="/en/stable/"><em>stable</em> version of the documentation</a>.
  15. </p>
  16. <p>
  17. Alternatively, use the
  18. <a href="#" onclick="$('#rtd-search-form [name=\\'q\\']').focus()">Search docs</a>
  19. box on the left or <a href="/">go to the homepage</a>.
  20. </p>
  21. <script>
  22. // If we were redirected to `/en/4.x/` as a result of the RTD language selector,
  23. // redirect to `/en/stable/` instead, as English does not have a `4.x` branch.
  24. // (For maintenance reasons, non-English languages have a single `4.x` branch
  25. // that is the counterpart of `4.3`, `4.4`, `4.5`, and so on.)
  26. if (window.location.pathname.includes('/en/4.x/')) {
  27. const newUrl = window.location.pathname.replace('/en/4.x/', '/en/stable/');
  28. window.location.replace(newUrl);
  29. }
  30. // Check for redirects if on a currently invalid page.
  31. // This is done in JavaScript, as we exceed Read the Docs' limit for the amount of redirects configurable.
  32. const currentPathSegments = window.location.pathname.split('/').filter(segment => segment !== '');
  33. // Use the base path (e.g. "/en/latest") when available.
  34. const currentBasePath = (currentPathSegments.length >= 2) ? ("/" + currentPathSegments.slice(0, 2).join("/")) : "/";
  35. fetch(currentBasePath + "/_static/redirects.csv")
  36. .then(response => response.text())
  37. .then(csvText => {
  38. const lines = csvText.trim().split('\n');
  39. for (const line of lines) {
  40. if (!line.trim()) {
  41. continue;
  42. }
  43. const [from, to] = line.split(',').map(s => s.trim());
  44. if (from && to) {
  45. if (window.location.pathname.endsWith(from)) {
  46. if (to.startsWith('https://')) {
  47. window.location.replace(to);
  48. } else {
  49. const newUrl = window.location.href.replace(window.location.pathname, to);
  50. window.location.replace(newUrl);
  51. }
  52. }
  53. }
  54. }
  55. })
  56. .catch(err => {
  57. console.error("Couldn't fetch redirects list:", err);
  58. });
  59. </script>