|
| 1 | +<script setup lang="ts"> |
| 2 | +const route = useRoute() |
| 3 | +
|
| 4 | +const { data: page } = await useAsyncData(`docs-${route.path}`, () => queryContent(route.path).findOne()) |
| 5 | +if (!page.value) |
| 6 | + throw createError({ statusCode: 404, statusMessage: 'Page not found' }) |
| 7 | +
|
| 8 | +const { data: surround } = await useAsyncData(`docs-${route.path}-surround`, () => queryContent() |
| 9 | + .where({ _extension: 'md', navigation: { $ne: false } }) |
| 10 | + .findSurround(route.path.endsWith('/') ? route.path.slice(0, -1) : route.path), |
| 11 | +) |
| 12 | +const isProvider = page.value._path.startsWith('/providers') |
| 13 | +
|
| 14 | +useSeoMeta({ |
| 15 | + titleTemplate: isProvider ? '%s - Nuxt Image Providers' : '%s - Nuxt Image', |
| 16 | + title: page.value.title, |
| 17 | + ogTitle: `${page.value.title} - ${isProvider ? 'Nuxt Image Providers' : 'Nuxt Image'}`, |
| 18 | + description: page.value.description, |
| 19 | + ogDescription: page.value.description |
| 20 | +}) |
| 21 | +
|
| 22 | +const headline = computed(() => findPageHeadline(page.value)) |
| 23 | +const communityLinks = computed(() => [ |
| 24 | + { |
| 25 | + icon: 'i-ph-pen-duotone', |
| 26 | + label: 'Edit this page', |
| 27 | + to: `https://github.com/nuxt-ui-pro/docs/edit/main/docs/content/${page?.value?._file}`, |
| 28 | + target: '_blank', |
| 29 | + }, |
| 30 | + { |
| 31 | + icon: 'i-ph-shooting-star-duotone', |
| 32 | + label: 'Star on GitHub', |
| 33 | + to: 'https://github.com/nuxt/ui', |
| 34 | + target: '_blank', |
| 35 | + }, |
| 36 | + { |
| 37 | + icon: 'i-simple-icons-nuxtdotjs', |
| 38 | + label: 'Purchase UI Pro', |
| 39 | + to: 'https://ui.nuxt.com/pro/purchase', |
| 40 | + target: '_blank', |
| 41 | + }, |
| 42 | +]) |
| 43 | +</script> |
| 44 | + |
| 45 | +<template> |
| 46 | + <UPage> |
| 47 | + <UPageHeader :title="page.title" :description="page.description" :links="page.links" :headline="headline" /> |
| 48 | + |
| 49 | + <UPageBody prose class="pb-0"> |
| 50 | + <ContentRenderer v-if="page.body" :value="page" /> |
| 51 | + <hr v-if="surround?.length" class="my-8"> |
| 52 | + <UDocsSurround :surround="surround" /> |
| 53 | + </UPageBody> |
| 54 | + |
| 55 | + <template v-if="page.body?.toc?.links?.length" #right> |
| 56 | + <UDocsToc :links="page.body.toc.links"> |
| 57 | + <template #bottom> |
| 58 | + <div class="hidden lg:block space-y-6 !mt-6"> |
| 59 | + <UDivider v-if="page.body?.toc?.links?.length" dashed /> |
| 60 | + <UPageLinks title="Community" :links="communityLinks" /> |
| 61 | + </div> |
| 62 | + </template> |
| 63 | + </UDocsToc> |
| 64 | + </template> |
| 65 | + </UPage> |
| 66 | +</template> |
0 commit comments