diff --git a/app/components/docs/DocsPageAsideLinks.vue b/app/components/docs/DocsPageAsideLinks.vue index 52a07b5..119b7ef 100644 --- a/app/components/docs/DocsPageAsideLinks.vue +++ b/app/components/docs/DocsPageAsideLinks.vue @@ -110,7 +110,6 @@ const items = [ :ui="{ list: 'gap-2.5' }" /> prodContent.se }) provide('navigation', navigation) + +// First real docs page, so a dead link still offers a way into the content. +const docsLink = computed(() => findFirstPagePath(navigation.value ?? []) ?? '/') + +interface NavigationNode { + path?: string + page?: boolean + children?: NavigationNode[] +} + +function findFirstPagePath(items: NavigationNode[]): string | undefined { + for (const item of items) { + if (item.page !== false && item.path && item.path !== '/') return item.path + if (item.children?.length) { + const child = findFirstPagePath(item.children) + if (child) return child + } + } +}