fix: use vuepress to setup 404 page

This commit is contained in:
Ze Bateira
2021-04-07 12:04:26 +01:00
committed by Zé Bateira
parent 0dc0be2a8b
commit 178ba052d7
4 changed files with 15 additions and 11 deletions

View File

@@ -138,6 +138,7 @@ module.exports = {
{
normalSuffix: '/',
indexSuffix: '/',
notFoundPath: '/ipfs-404.html',
},
],
[
@@ -175,7 +176,7 @@ module.exports = {
sitemap: {
hostname: CANONICAL_BASE,
changefreq: 'weekly',
exclude: ['/image-crop/', '/404.html'],
exclude: ['/image-crop/', '/ipfs-404.html'],
},
directories: [
{

View File

@@ -1,10 +0,0 @@
<html>
<head>
<title>IPFS Blog &amp; News</title>
</head>
<body>
<script>
window.location.pathname = '/404.html'
</script>
</body>
</html>

View File

@@ -16,12 +16,24 @@
<script>
import Layout from '@theme/layouts/Layout.vue'
import countly from '../util/countly'
export default {
name: 'NotFound',
components: {
Layout,
},
created() {
if (typeof this.$ssrContext !== 'undefined') {
this.$ssrContext.userHeadTags += `<base href="/" />`
}
},
mounted() {
countly.trackEvent(countly.events.NOT_FOUND, {
path: this.$route.path,
referrer: typeof window !== 'undefined' ? document.referrer : null,
})
},
}
</script>

View File

@@ -8,6 +8,7 @@ export const events = {
LOAD_MORE_BUTTON: 'loadMoreButton',
NEWSLETTER_SUBSCRIBE: 'newsletterSubscribe',
FILTER: 'filter',
NOT_FOUND: '404NotFound',
}
/*
Load Countly script.