-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afce1f6
commit 5a83626
Showing
14 changed files
with
227 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<script setup lang="ts"> | ||
import type { NavItem } from '@nuxt/content/types'; | ||
import { withoutTrailingSlash } from 'ufo'; | ||
const route = useRoute(); | ||
const { seo } = useAppConfig(); | ||
const navigation = inject<Ref<NavItem[]>>('navigation', ref([])); | ||
const { data: page } = await useAsyncData(route.path, () => queryContent(route.path).findOne()); | ||
if (!page.value) { | ||
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true }); | ||
} | ||
const { data: surround }: any = await useAsyncData(`${route.path}-surround`, () => | ||
queryContent() | ||
.where({ | ||
_partial: false, | ||
_extension: 'md', | ||
navigation: { $ne: false }, | ||
}) | ||
.only(['title', 'description', '_path']) | ||
.findSurround(withoutTrailingSlash(route.path)) | ||
); | ||
useSeoMeta({ | ||
title: page.value.title, | ||
ogTitle: `${page.value.title} - ${seo?.siteName}`, | ||
description: page.value.description, | ||
ogDescription: page.value.description, | ||
}); | ||
defineOgImage({ | ||
component: 'Docs', | ||
}); | ||
const breadcrumb = computed(() => | ||
mapContentNavigation(findPageBreadcrumb(navigation!.value, page.value)).map(({ label }) => ({ label })) | ||
); | ||
</script> | ||
|
||
<template> | ||
<UPage v-if="page"> | ||
<UPageHeader | ||
:title="page.title" | ||
:description="page.description" | ||
:links="page.links" | ||
> | ||
<template #headline> | ||
<UBreadcrumb :links="breadcrumb" /> | ||
</template> | ||
</UPageHeader> | ||
|
||
<UPageBody prose> | ||
<ContentRenderer | ||
v-if="page.body" | ||
:value="page" | ||
/> | ||
|
||
<hr v-if="surround?.length" /> | ||
|
||
<UContentSurround :surround="surround" /> | ||
</UPageBody> | ||
|
||
<template | ||
v-if="page.toc !== false" | ||
#right | ||
> | ||
<LayoutToc :page /> | ||
</template> | ||
</UPage> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<script setup lang="ts"> | ||
import type { ParsedContent } from '@nuxt/content/types'; | ||
const { toc } = useAppConfig(); | ||
const props = defineProps<{ | ||
page: ParsedContent; | ||
}>(); | ||
const links = computed(() => | ||
[ | ||
toc?.bottom?.edit && { | ||
icon: 'i-heroicons-pencil-square', | ||
label: 'Edit this page', | ||
to: `${toc.bottom.edit}/${props.page?.value?._file}`, | ||
target: '_blank', | ||
}, | ||
toc?.bottom?.feedback && { | ||
icon: 'i-heroicons-chat-bubble-oval-left-ellipsis', | ||
label: 'Share feedback', | ||
to: `${toc.bottom.feedback}&title=Feedback for ${props.page?.value?.title}&body=Page: ${props.page?.value?._path}`, | ||
target: '_blank', | ||
}, | ||
...(toc?.bottom?.links || []), | ||
].filter(Boolean) | ||
); | ||
</script> | ||
|
||
<template> | ||
<UContentToc | ||
:title="toc?.title" | ||
:links="page.body?.toc?.links" | ||
> | ||
<template | ||
v-if="toc?.bottom" | ||
#bottom | ||
> | ||
<div | ||
class="hidden space-y-6 lg:block" | ||
:class="{ '!mt-6': page.body?.toc?.links?.length }" | ||
> | ||
<UDivider | ||
v-if="page.body?.toc?.links?.length" | ||
type="dashed" | ||
/> | ||
|
||
<UPageLinks | ||
:title="toc.bottom.title" | ||
:links="links" | ||
/> | ||
</div> | ||
</template> | ||
</UContentToc> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
title: Test | ||
--- | ||
|
||
This is a test page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.