Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 404 page (missing tabs property was making it render funny). #371

Merged
merged 1 commit into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions web/404.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
---
permalink: /404.html
layout: default
tab: 100
---

<div class="container">
<h1>404</h1>
<div v-if="isDocsPage()">
<h1>404</h1>
<p><strong>Page not found</strong></p>
<p>This version of the documentation does not contain this page. Please go to the <a :href="getMainDocsPage()">main documentation page</a>.
</div>
<div v-else>

<p><strong>Page not found :(</strong></p>
<p>The requested page could not be found.</p>
<h1>404</h1>

<p><strong>Page not found</strong></p>
<p>The requested page could not be found.</p>
</div>
</div>
4 changes: 3 additions & 1 deletion web/_includes/vueinit.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
},
methods: {
getSortedVersionLabels: getSortedVersionLabels,
setVersion: setVersion
setVersion: setVersion,
getMainDocsPage: getMainDocsPage,
isDocsPage: isDocsPage
}
});

Expand Down
20 changes: 19 additions & 1 deletion web/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function setVersion() {
* currently displayed documentation version.
*/
function getCurrentVersion() {
v = splitLocation()[1];
var v = splitLocation()[1];
if (v == "") {
return v;
}
Expand All @@ -228,4 +228,22 @@ function getCurrentVersion() {
}
}

/**
* Returns the main documentation page for the current version by removing
* everything after <code>"../docs/v/x.y.z/"</code> from the current URL.
*/
function getMainDocsPage() {
var s = splitLocation();

return s[0] + "/" + s[1] + "/";
}

/**
* Returns true if the current URL points to a versioned documentation
* page.
*/
function isDocsPage() {
return window.location.href.includes("/docs/v/");
}

initVersions();