-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(python-sdk): created 404 message for older versions
- copied and adjusted 404 html layout from docs theme - created js script to check for available versions to show corresponding 404 message JIRA: DP-2808
- Loading branch information
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{{ define "main" -}} | ||
<div class="row default-404"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-12 col-lg-6"> | ||
<h2 class="mt-0">404 Page</h2> | ||
<h1>Ohh, there is nothing in here!</h1> | ||
|
||
{{ if and (isset .Site.Params "404") (isset (index .Site.Params "404") "links") }} | ||
<div class="mt-7"> | ||
<h2 class="mb-4">But you can try:</h2> | ||
<ul class="mt-2"> | ||
{{ range index (index .Site.Params "404") "links" }} | ||
<li> | ||
<a href="{{ .link }}">{{ .title }}</a> | ||
</li> | ||
{{ end }} | ||
</ul> | ||
</div> | ||
{{ end }} | ||
</div> | ||
<div class="col-12 col-lg-6 d-flex align-items-center justify-content-end"> | ||
<img class="mw-100" src="https://www.gooddata.com/img/pages/error/error-404_animation.svg" alt="Where did it go?"> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="row old-version__404 d-none"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-12 col-lg-6"> | ||
<h2 class="mt-0">404 Page</h2> | ||
<h1>This version is no longer live</h1> | ||
|
||
{{ if and (isset .Site.Params "404") (isset (index .Site.Params "404") "links") }} | ||
<div class="mt-7"> | ||
<h2 class="mb-4">But you can try:</h2> | ||
<a href="https://gooddata.com/docs/python-sdk/latest/">Latest version of Python SDK</a> | ||
<p>You can find past versions of the documentation in the Python SDK <a href="https://github.com/gooddata/gooddata-python-sdk">GitHub repository</a>. To retrieve older version, follow the instructions in the <a href="https://github.com/gooddata/gooddata-python-sdk/blob/master/CONTRIBUTING.md">README</a>.</p> | ||
</div> | ||
{{ end }} | ||
|
||
</div> | ||
<div class="col-12 col-lg-6 d-flex align-items-center justify-content-end"> | ||
<img class="mw-100" src="https://www.gooddata.com/img/pages/error/error-404_animation.svg" alt="Where did it go?"> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} | ||
} | ||
|
||
}); |