Skip to content

Commit

Permalink
fix: handle undefined navigation in more places (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Oct 12, 2022
1 parent 46d526d commit 2a7c428
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion theme/components/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { navKeyFromPath } = useContentHelpers()
const titleTemplate = computed(() => {
const appTitleTemplate = docus.value.head?.titleTemplate || `%s · ${docus.value.title}`
if (page.value) {
return page.value.head?.titleTemplate || navKeyFromPath(page.value._path, 'titleTemplate', navigation.value) || appTitleTemplate
return page.value.head?.titleTemplate || navKeyFromPath(page.value._path, 'titleTemplate', navigation.value || []) || appTitleTemplate
}
return appTitleTemplate
})
Expand Down
2 changes: 1 addition & 1 deletion theme/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const { navigation } = useContent()
const { hasDocSearch } = useDocSearch()
const hasNavbarDialog = computed(() => navigation.value.length > 1)
const hasNavbarDialog = computed(() => navigation.value?.length > 1)
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion theme/components/docs/DocsPageContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const hasBody = computed(() => !page.value || page.value?.body?.children?.length
const hasToc = computed(() => page.value?.toc !== false && page.value?.body?.toc?.links?.length >= 2)
// TODO: get navigation links from aside level
const hasAside = computed(() => page.value?.aside !== false && navigation.value.length > 1)
const hasAside = computed(() => page.value?.aside !== false && navigation.value?.length > 1)
const bottom = computed(() => fallbackValue('bottom', true))
const isOpen = ref(false)
Expand Down

1 comment on commit 2a7c428

@vercel
Copy link

@vercel vercel bot commented on 2a7c428 Oct 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.