Skip to content

Commit

Permalink
Merge pull request #371 from ExaWorks/add_404_page
Browse files Browse the repository at this point in the history
Fix 404 page (missing tabs property was making it render funny).
  • Loading branch information
hategan authored Mar 29, 2023
2 parents 34d3ae6 + 39a54ee commit 3a15a55
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
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();

0 comments on commit 3a15a55

Please sign in to comment.