Skip to content

Commit 262ecf0

Browse files
committed
Added: redirect to home when no content available at blog page
1 parent 025fe04 commit 262ecf0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pages/blog.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ const projectsCreatedData = computed(() => {
134134
135135
const projectsPending = computed(() => projectsAllQuery.status.value === 'pending')
136136
137+
const anythingPending = computed(() => projectsPending.value || postsPending.value)
138+
watch(anythingPending, (pending) => {
139+
if (
140+
!pending
141+
&& projectsLatestData.value.length === 0
142+
&& postsLatestIntoPostData.value.length === 0
143+
)
144+
navigateTo('/', { replace: true, redirectCode: 404 })
145+
}, { immediate: true })
146+
137147
useSeoMetaHelper({
138148
title: 'Blog',
139149
description: 'Helltraitor blog',

0 commit comments

Comments
 (0)