diff --git a/docs/layouts/404.html b/docs/layouts/404.html new file mode 100644 index 000000000..1a4eac835 --- /dev/null +++ b/docs/layouts/404.html @@ -0,0 +1,51 @@ +{{ define "main" -}} +
+
+
+
+

404 Page

+

Ohh, there is nothing in here!

+ + {{ if and (isset .Site.Params "404") (isset (index .Site.Params "404") "links") }} +
+

But you can try:

+
    + {{ range index (index .Site.Params "404") "links" }} +
  • + {{ .title }} +
  • + {{ end }} +
+
+ {{ end }} +
+
+ Where did it go? +
+
+
+
+ +
+
+
+
+

404 Page

+

This version is no longer live

+ + {{ if and (isset .Site.Params "404") (isset (index .Site.Params "404") "links") }} +
+

But you can try:

+ Latest version of Python SDK +

You can find past versions of the documentation in the Python SDK GitHub repository. To retrieve older version, follow the instructions in the README.

+
+ {{ end }} + +
+
+ Where did it go? +
+
+
+
+{{- end }} diff --git a/docs/layouts/partials/hooks/body-end.html b/docs/layouts/partials/hooks/body-end.html index 25c44f93c..8bac99336 100644 --- a/docs/layouts/partials/hooks/body-end.html +++ b/docs/layouts/partials/hooks/body-end.html @@ -4,3 +4,5 @@ + + diff --git a/docs/static/js/404-old-version.js b/docs/static/js/404-old-version.js new file mode 100644 index 000000000..f74f4b591 --- /dev/null +++ b/docs/static/js/404-old-version.js @@ -0,0 +1,26 @@ +$(document).ready(function () { + const defaultError = document.querySelector(".default-404"); + const newError = document.querySelector(".old-version__404"); + const dropdownItems = document.getElementsByClassName("dropdown-item"); + const availableVersions = ["latest"]; + + // put each available version into array availableVersions + [...dropdownItems].forEach((element) => { + availableVersions.push(element.innerText.trim()); + }); + + if (window.location) { + // pathname of the current page + const pathname = window.location.pathname; + + // extract version from pathname + const version = pathname.split('/')[1]; + + // Check if the version extracted is a valid version, if it is included in available versions and if it matches the regex digit format + if (version && !availableVersions.includes(version) && version.match(/^\d+\.\d+$/)) { + newError.classList.toggle("d-none"); + defaultError.classList.toggle("d-none"); + } + } + +});