Skip to content

Commit

Permalink
fix: support missing vue-router
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Dec 23, 2022
1 parent f732942 commit 6e81882
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/SeoKit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ useHead({
return route.value.meta?.title
// if no title has been set then we should use the last segment of the URL path and title case it
const path = route.value.path
const path = route.value?.path || '/'
const lastSegment = path.split('/').pop()
return lastSegment ? titleCase(lastSegment) : ''
},
Expand All @@ -54,7 +54,7 @@ useHead({
})
useSeoMeta({
ogUrl: () => resolveUrl(route.value.path),
ogUrl: () => resolveUrl(route.value?.path || '/'),
ogLocale: () => siteMeta.value.language,
ogSiteName: () => siteMeta.value.siteName,
ogType: 'website',
Expand All @@ -73,7 +73,7 @@ useHead({
},
{
rel: 'canonical',
href: () => resolveUrl(`${route.value.path}`),
href: () => resolveUrl(route.value?.path || '/'),
},
],
})
Expand Down

0 comments on commit 6e81882

Please sign in to comment.