diff --git a/components/layout/PrevNext.vue b/components/layout/PrevNext.vue index aeb7cb91..82609b64 100644 --- a/components/layout/PrevNext.vue +++ b/components/layout/PrevNext.vue @@ -1,5 +1,5 @@ diff --git a/composables/useBreadcrumb.ts b/composables/useBreadcrumb.ts index 199a2a90..e779fd5e 100644 --- a/composables/useBreadcrumb.ts +++ b/composables/useBreadcrumb.ts @@ -13,10 +13,14 @@ export function useBreadcrumb(url: string): BreadcrumbItem[] { // Construct breadcrumb for each segment let href = ''; let nav = navigation.value; + + if (!nav) + return []; + for (let i = 0; i < segments.length; i++) { const segment = segments[i].replace('.html', ''); href += `/${segment}`; - const page = nav.find(x => (x._path as string) === href); + const page = nav?.find(x => (x._path as string) === href); nav = page?.children; breadcrumbItems.push({ title: page?.title ?? segment, href }); } diff --git a/content/1.getting-started/3.writing/2.pages.md b/content/1.getting-started/3.writing/2.pages.md index ab9b90c9..35a9866f 100644 --- a/content/1.getting-started/3.writing/2.pages.md +++ b/content/1.getting-started/3.writing/2.pages.md @@ -59,4 +59,10 @@ badges: ::field{name="editLink" type="boolean" default-value="true"} Whether to show the edit link for this page. :: + ::field{name="prevNext" type="boolean" default-value="true"} + Whether to show the previous & next page buttons. + :: + ::field{name="breadcrumb" type="boolean" default-value="true"} + Whether to show the breadcrumb. + :: :: diff --git a/content/3.api/1.configuration/1.shadcn-docs.md b/content/3.api/1.configuration/1.shadcn-docs.md index 7ac74c59..22a85e42 100644 --- a/content/3.api/1.configuration/1.shadcn-docs.md +++ b/content/3.api/1.configuration/1.shadcn-docs.md @@ -226,7 +226,7 @@ All configurable icons can be set to iconify icons, emojis and urls, using [smar ::field-group ::field{name="credits" type="string" defaultValue="''"} - The credit text on the left side of the footer. + The credit text on the left side of the footer (parsed by the MDC parser). :: ::field{name="links" type="ILink[]" defaultValue="[]"} The links on the right side of the footer. diff --git a/content/index.md b/content/index.md index 370d0a89..31136403 100644 --- a/content/index.md +++ b/content/index.md @@ -6,7 +6,7 @@ navigation: false ::hero --- announcement: - title: 'Release v0.8.4' + title: 'Release v0.8.5' icon: '🎉' to: https://github.com/ZTL-UwU/shadcn-docs-nuxt/releases/latest target: _blank diff --git a/nuxt.config.ts b/nuxt.config.ts index 3f9d5cb3..2fa71d82 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -53,6 +53,8 @@ export default defineNuxtConfig({ 'sidebar', 'collapse', 'editLink', + 'prevNext', + 'breadcrumb', ], }, experimental: { diff --git a/package.json b/package.json index d11771e1..f782568a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "shadcn-docs-nuxt", "type": "module", - "version": "0.8.4", + "version": "0.8.5", "description": "Effortless and beautiful docs template built with Nuxt Content & shadcn-vue.", "author": "Tony Zhang ", "license": "MIT", diff --git a/pages/[...slug].vue b/pages/[...slug].vue index 55ae4237..432f6604 100644 --- a/pages/[...slug].vue +++ b/pages/[...slug].vue @@ -17,7 +17,7 @@ :class="[config.toc.enable && (page.toc ?? true) && 'lg:grid lg:grid-cols-[1fr_220px] lg:gap-14 lg:py-8']" >
- +