From 6a15b11c4b9aca180ba769f12aa40fc6c1d016e0 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 14 Jan 2022 14:06:38 +0530 Subject: [PATCH] fix: reset page data on 404 --- src/client/app/router.ts | 9 +++++++++ src/client/theme-default/components/LastUpdated.vue | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 14c91206..49bf9441 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -109,6 +109,15 @@ export function createRouter( latestPendingPath = null route.path = pendingPath route.component = fallbackComponent ? markRaw(fallbackComponent) : null + // reset page data + route.data = { + relativePath: '', + title: '404', + description: 'Not Found', + headers: [], + frontmatter: {}, + lastUpdated: 0 + } } } } diff --git a/src/client/theme-default/components/LastUpdated.vue b/src/client/theme-default/components/LastUpdated.vue index ab888fbc..3191ab05 100644 --- a/src/client/theme-default/components/LastUpdated.vue +++ b/src/client/theme-default/components/LastUpdated.vue @@ -7,7 +7,7 @@ const { theme, page } = useData() const hasLastUpdated = computed(() => { const lu = theme.value.lastUpdated - return lu !== undefined && lu !== false + return lu !== undefined && lu !== false && page.value.lastUpdated !== 0 }) const prefix = computed(() => {