Skip to content

Commit

Permalink
feat: 404 page added (#5444)
Browse files Browse the repository at this point in the history
  • Loading branch information
roger-in-kiva authored Aug 15, 2024
1 parent 1716db4 commit c477382
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/pages/NotFound.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<template>
<www-page>
<kv-page-container
class="tw-pt-4 tw-pb-8"
>
<h2 class="tw-text-center tw-mb-2">
The page you're looking for has gone missing!
</h2>
<p class="tw-text-center">
Please double check the spelling of the URL, or try one of these links:
</p>

<div class="tw-flex tw-flex-col tw-text-center tw-my-5 tw-gap-y-2 tw-text-subhead">
<router-link to="/">
Home
</router-link>
<router-link to="/lend">
Lend
</router-link>
<router-link to="/borrow">
Borrow
</router-link>
<router-link to="/blog">
Blog
</router-link>
<router-link to="/portfolio">
My portfolio
</router-link>
</div>

<p class="tw-text-center">
If you need us, we’re always available via email at
<a href="mailto:contactus@kiva.org">contactus@kiva.org</a>.
</p>
</kv-page-container>
</www-page>
</template>

<script>
import WwwPage from '@/components/WwwFrame/WwwPage';
import KvPageContainer from '~/@kiva/kv-components/vue/KvPageContainer';
export default {
name: 'NotFound',
components: {
WwwPage,
KvPageContainer,
},
beforeRouteEnter(to, from, next) {
if (typeof window !== 'undefined') {
// No routes match our path, so force a page refresh to that path for other apps to handle.
window.location = to.fullPath;
} else {
// We're in a server environment, so redirecting would just bring us back here.
// Instead, we'll just render this page as normal.
next();
}
},
};
</script>
8 changes: 8 additions & 0 deletions src/router/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,4 +686,12 @@ module.exports = [
excludeFromStaticSitemap: true,
}
},
// Catch all route
{
path: '/:pathMatch(.*)*',
component: () => import('@/pages/NotFound'),
meta: {
excludeFromStaticSitemap: true,
}
},
];

0 comments on commit c477382

Please sign in to comment.