Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle undefined navigation in more places #643

Merged
merged 1 commit into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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