Skip to content

Commit

Permalink
Merge pull request #369 from shivendra-webkul/redirect-link
Browse files Browse the repository at this point in the history
Added Redirect link in page not found error page
  • Loading branch information
devansh-webkul authored Feb 9, 2024
2 parents 9bbe267 + f5df57c commit 1c4d21b
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 16 deletions.
13 changes: 7 additions & 6 deletions docs/.vuepress/theme/components/TopNav.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<template>
<div class="top-nav">
<div class="nav-text">
{{ displayText }}
</div>
<div class="nav-text" v-html="displayText"> </div>
</div>
</template>

Expand Down Expand Up @@ -31,13 +29,12 @@ export default {
let version = currentPath[1];
if (['2.x'].includes(version)) {
this.displayText = 'This is the documentation for the current version (v2.0) of Bagisto. Stay informed and make the most of Bagisto\'s capabilities.';
this.displayText = `This is the documentation for the current version (v2.0) of Bagisto. Stay informed and make the most of Bagisto\'s capabilities.`;
} else {
this.displayText = 'Heads up: You are viewing outdated documentation for Bagisto. Please consider upgrading to v2.0 for the latest information.';
this.displayText = `Heads up: You are viewing outdated documentation for Bagisto. Please consider upgrading to <a class="nav-text latest-version-link" href="/2.x/prologue">v2.0</a> for the latest information.`;
}
},
},
}
</script>

Expand All @@ -63,6 +60,10 @@ export default {
font: bold;
}
.latest-version-link {
text-decoration: underline;
}
/* Responsive Styles */
@media (max-width: 500px) {
.top-nav {
Expand Down
62 changes: 52 additions & 10 deletions docs/.vuepress/theme/layouts/404.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,72 @@
<template>
<div class="theme-container">
<div class="theme-container" style="padding-right: 20px;">
<div class="theme-default-content">
<h1>404</h1>
<img src="/logo.png" alt="Bagisto Documentation" class="logo" style="height: 86px; width: 200px;">

<blockquote>{{ getMsg() }}</blockquote>
<h1>Page not found.</h1>

<RouterLink to="/">
Take me home.
</RouterLink>
<div class="warning-container">
<div>
<strong>! WARNING</strong> You're browsing the documentation for an old version of Bagisto. Consider upgrading your project to Bagisto v2.x.
</div>

<div>
<blockquote>{{ getMsg() }}</blockquote>
</div>
</div>

<div class="link">
<div>
<a @click="e => getCurrentUrl(e, '2.x')">
v2.x.(Latest)
</a>
</div>
<div>
<a @click="e => getCurrentUrl(e, '1.5.x')">
v1.5.x.
</a>
</div>
</div>
</div>
</div>
</template>

<script>
const msgs = [
`There's nothing here.`,
`How did we get here?`,
`That's a Four-Oh-Four.`,
`Looks like we've got some broken links.`
`This page does not exist for this version of Bagisto but was found in other versions.`,
]
export default {
methods: {
getMsg () {
return msgs[Math.floor(Math.random() * msgs.length)]
},
getCurrentUrl(e, version) {
e.preventDefault();
var currentURL = window.location.href;
var newURL = currentURL.replace('1.x', version);
window.location.href = newURL;
}
}
}
</script>

<style scoped>
.warning-container {
border: 1px solid #E9E9E9; /* Added "solid" to specify the border style and "black" for the color */
border-radius: 10px;
height: 100%;
width: 100%;
padding: 20px 10px 10px 10px;
margin: 10px 0px 20px 0px;
}
.link {
display: grid;
gap: 10px;
cursor: pointer;
}
</style>

0 comments on commit 1c4d21b

Please sign in to comment.