Skip to content

Commit 13d93fa

Browse files
committed
feat: added docs page
1 parent 47f7645 commit 13d93fa

File tree

13 files changed

+81
-98
lines changed

13 files changed

+81
-98
lines changed

app/error.vue

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ useHead({
1414
}
1515
})
1616
17+
const { data: app } = await useAsyncData('app-error', () => queryCollection('app').first())
18+
1719
useSeoMeta({
18-
title: 'Page not found',
19-
description: 'We are sorry but this page could not be found.'
20+
title: app.value?.error.title || 'Page not found',
21+
description: app.value?.error.description || 'We are sorry but this page could not be found.'
2022
})
2123
2224
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('docs'), {
@@ -25,20 +27,6 @@ const { data: navigation } = await useAsyncData('navigation', () => queryCollect
2527
const { data: files } = useLazyAsyncData('search', () => queryCollectionSearchSections('docs'), {
2628
server: false
2729
})
28-
29-
const links = [{
30-
label: 'Docs',
31-
icon: 'i-lucide-book',
32-
to: '/docs/getting-started'
33-
}, {
34-
label: 'Pricing',
35-
icon: 'i-lucide-credit-card',
36-
to: '/pricing'
37-
}, {
38-
label: 'Blog',
39-
icon: 'i-lucide-pencil',
40-
to: '/blog'
41-
}]
4230
</script>
4331

4432
<template>
@@ -60,7 +48,7 @@ const links = [{
6048
:files="files"
6149
shortcut="meta_k"
6250
:navigation="navigation"
63-
:links="links"
51+
:links="app?.links"
6452
:fuse="{ resultLimit: 42 }"
6553
/>
6654
</ClientOnly>

app/pages/docs/[...slug].vue

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,57 @@
11
<script setup lang="ts">
2+
definePageMeta({
3+
layout: 'docs'
4+
})
25
6+
const route = useRoute()
7+
8+
const { data: page } = await useAsyncData(route.path, () => queryCollection('docs').path(route.path).first())
9+
if (!page.value) {
10+
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
11+
}
12+
13+
const { data: surround } = await useAsyncData(`${route.path}-surround`, () => {
14+
return queryCollectionItemSurroundings('docs', route.path, {
15+
fields: ['description']
16+
})
17+
})
18+
19+
const title = page.value.seo?.title || page.value.title
20+
const description = page.value.seo?.description || page.value.description
21+
22+
useSeoMeta({
23+
title,
24+
ogTitle: title,
25+
description,
26+
ogDescription: description
27+
})
28+
29+
defineOgImageComponent('Saas')
330
</script>
431

532
<template>
6-
<div>
7-
<!-- -->
8-
</div>
33+
<UPage v-if="page">
34+
<UPageHeader
35+
:title="page.title"
36+
:description="page.description"
37+
/>
38+
39+
<UPageBody>
40+
<ContentRenderer
41+
v-if="page.body"
42+
:value="page"
43+
/>
44+
45+
<USeparator v-if="surround?.length" />
46+
47+
<UContentSurround :surround="surround" />
48+
</UPageBody>
49+
50+
<template
51+
v-if="page?.body?.toc?.links?.length"
52+
#right
53+
>
54+
<UContentToc :links="page.body.toc.links" />
55+
</template>
56+
</UPage>
957
</template>

bun.lock

Lines changed: 7 additions & 73 deletions
Large diffs are not rendered by default.

content.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const collections = {
7070
source: 'app.yml',
7171
schema: z.object({
7272
links: z.array(createLinkSchema()).optional(),
73+
error: createBaseSchema(),
7374
header: z.object({
7475
logo: z.object({
7576
to: z.string()

content/1.docs/1.getting-started/.navigation.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

content/1.docs/1.user/.navigation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: User
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: Developer

content/1.docs/2.developer/1.index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Introduction
3+
description: Welcome to our Developer Guide
4+
---
5+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: Installation
3+
description: Get started with the installation of our software.
4+
---

content/app.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ links:
33
icon: i-lucide-book
44
to: /docs
55
children:
6-
- label: User Guide
6+
- label: User
77
icon: i-lucide-book-text
88
description: Get started with our user-friendly guide.
99
to: /docs/user
1010
disabled: false
11-
- label: Developer Guide
11+
- label: Developer
1212
icon: i-lucide-code-xml
1313
description: Dive into our developer documentation.
1414
to: /docs/developer
@@ -30,6 +30,9 @@ links:
3030
icon: i-simple-icons-github
3131
to: https://github.com/projectm-visualizer
3232
target: '_blank'
33+
error:
34+
title: Page not found
35+
description: We are sorry but this page could not be found.
3336
header:
3437
logo:
3538
to: /
@@ -69,4 +72,3 @@ footer:
6972
icon: i-simple-icons-github
7073
to: https://github.com/projectm-visualizer
7174
target: _blank
72-

nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default defineNuxtConfig({
3131
},
3232

3333
routeRules: {
34-
'/docs': { redirect: '/docs/getting-started', prerender: false }
34+
'/docs': { redirect: '/docs/user', prerender: false }
3535
},
3636

3737
future: {

0 commit comments

Comments
 (0)