Skip to content

Commit d501b6c

Browse files
committed
docs: various improvements
1 parent 1bcd77b commit d501b6c

File tree

23 files changed

+338
-195
lines changed

23 files changed

+338
-195
lines changed

docs/app/app.vue

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,15 @@
11
<script setup lang="ts">
22
import { withoutTrailingSlash } from 'ufo'
3-
import colors from 'tailwindcss/colors'
43
54
const route = useRoute()
6-
const appConfig = useAppConfig()
7-
const colorMode = useColorMode()
85
96
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('docs'))
107
const { data: files } = useLazyAsyncData('search', () => queryCollectionSearchSections('docs'), {
118
server: false,
129
})
1310
14-
const searchTerm = ref('')
15-
16-
// watch(searchTerm, debounce((query: string) => {
17-
// if (!query) {
18-
// return
19-
// }
20-
21-
// useTrackEvent('Search', { props: { query: `${query} - ${searchTerm.value?.commandPaletteRef.results.length} results` } })
22-
// }, 500))
23-
24-
const links = computed(() => {
25-
return [{
26-
label: 'Docs',
27-
icon: 'i-lucide-book',
28-
to: '/docs/getting-started',
29-
active: route.path.startsWith('/docs'),
30-
}].filter(Boolean)
31-
})
32-
33-
const color = computed(() => colorMode.value === 'dark' ? colors[appConfig.ui.colors.neutral as keyof typeof colors][900] : 'white')
11+
const links = useNavLinks()
12+
const color = useThemeColor()
3413
3514
useHead({
3615
meta: [
@@ -39,7 +18,7 @@ useHead({
3918
],
4019
link: [
4120
{ rel: 'icon', type: 'image/svg+xml', href: '/icon.svg' },
42-
{ rel: 'canonical', href: `https://content.nuxt.com${withoutTrailingSlash(route.path)}` },
21+
{ rel: 'canonical', href: `https://content3.nuxt.dev${withoutTrailingSlash(route.path)}` },
4322
],
4423
htmlAttrs: {
4524
lang: 'en',
@@ -69,7 +48,6 @@ provide('navigation', navigation)
6948

7049
<ClientOnly>
7150
<LazyUContentSearch
72-
v-model:search-term="searchTerm"
7351
:files="files"
7452
:navigation="navigation"
7553
:fuse="{ resultLimit: 42 }"

docs/app/components/AppHeader.vue

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ const props = defineProps<{
88
99
const config = useRuntimeConfig().public
1010
11-
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
11+
const nav = inject<Ref<ContentNavigationItem[]>>('navigation')
1212
1313
const items = computed(() => props.links.map(({ icon, ...link }) => link))
14+
const navigation = computed(() => nav?.value.find(item => item.path === '/docs')?.children || [])
1415
1516
defineShortcuts({
1617
meta_g: () => {
@@ -33,18 +34,26 @@ defineShortcuts({
3334
:label="`v${config.version}`"
3435
variant="subtle"
3536
size="sm"
36-
class="-mb-[2px] font-semibold inline-block truncate"
37+
class="hidden -mb-[2px] font-semibold sm:inline-block truncate"
3738
/>
3839
</NuxtLink>
3940
</template>
4041

41-
<UNavigationMenu
42+
<!-- <UNavigationMenu
4243
:items="items"
4344
variant="link"
44-
/>
45+
/> -->
4546

4647
<template #right>
47-
<UColorModeButton />
48+
<UButton
49+
v-if="$route.path === '/'"
50+
label="Get started"
51+
to="/docs/getting-started"
52+
size="sm"
53+
class="hidden sm:inline-flex"
54+
/>
55+
56+
<UColorModeButton class="hidden sm:inline-flex" />
4857

4958
<UTooltip
5059
text="Search"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script setup lang="ts">
2+
defineProps<{
3+
image: string
4+
}>()
5+
</script>
6+
7+
<template>
8+
<section class="flex flex-col sm:flex-row sm:items-center flex-col-reverse gap-4 py-8 sm:gap-12 sm:py-12">
9+
<div>
10+
<h1 class="text-4xl font-semibold">
11+
<slot name="title" />
12+
</h1>
13+
<div class="text-base text-gray-600 dark:text-gray-300">
14+
<slot name="description" />
15+
</div>
16+
</div>
17+
<img
18+
:src="image"
19+
class="w-1/2 rounded-lg"
20+
>
21+
</section>
22+
</template>

docs/app/composables/nav.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import colors from 'tailwindcss/colors'
2+
3+
export const useNavLinks = () => {
4+
const route = useRoute()
5+
6+
return computed(() => [{
7+
label: 'Documentation',
8+
icon: 'i-lucide-book',
9+
to: '/docs/getting-started',
10+
active: route.path.startsWith('/docs'),
11+
}])
12+
}
13+
14+
export const useThemeColor = () => {
15+
const colorMode = useColorMode()
16+
const appConfig = useAppConfig()
17+
18+
return computed(() => colorMode.value === 'dark' ? colors[appConfig.ui.colors.neutral as keyof typeof colors][900] : 'white')
19+
}

docs/app/error.vue

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11
<script setup lang="ts">
2-
import colors from 'tailwindcss/colors'
32
import type { NuxtError } from '#app'
43
54
const props = defineProps<{
65
error: NuxtError
76
}>()
87
9-
const route = useRoute()
10-
const appConfig = useAppConfig()
11-
const colorMode = useColorMode()
12-
138
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('docs'))
149
const { data: files } = await useAsyncData('files', () => queryCollectionSearchSections('docs', { ignoredTags: ['style'] }))
1510
16-
const color = computed(() => colorMode.value === 'dark' ? colors[appConfig.ui.colors.neutral as keyof typeof colors][900] : 'white')
17-
18-
const links = computed(() => {
19-
return [{
20-
label: 'Docs',
21-
icon: 'i-lucide-book',
22-
to: '/docs/getting-started',
23-
active: route.path.startsWith('/docs'),
24-
}].filter(Boolean)
25-
})
11+
const links = useNavLinks()
12+
const color = useThemeColor()
2613
2714
useHead({
2815
meta: [

docs/app/pages/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ if (!page.value) {
4242
:ui="{
4343
title: 'font-semibold lg:text-4xl',
4444
featureLeadingIcon: 'text-[var(--ui-text-highlighted)]',
45+
container: section.code ? 'lg:items-start' : '',
46+
wrapper: section.code ? 'pt-10' : '',
4547
...(section.ui || {}),
4648
}"
4749
>

docs/app/plugins/home.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ExampleLandingHero, PreviewCard } from '#components'
2+
3+
// Fix error on components not found in landing page
4+
// maybe because it's within a .yml file?
5+
export default defineNuxtPlugin((nuxtApp) => {
6+
nuxtApp.vueApp.component('ExampleLandingHero', ExampleLandingHero)
7+
nuxtApp.vueApp.component('PreviewCard', PreviewCard)
8+
})

docs/content/docs/.navigation.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
title: Documentation

docs/content/docs/1.getting-started/3.configuration.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ export default defineNuxtConfig({
7373
})
7474
```
7575

76-
### `LibSQL` / `Turso`
76+
### `LibSQL`
7777

78-
If you plan to deploy your application using LibSQL/Turso database you need to use `libsql` database adapter.
78+
If you plan to deploy your application using LibSQL database you need to use `libsql` database adapter.
7979

8080
First, make sure to install the `@libsql/client` package:
8181

@@ -97,6 +97,10 @@ export default defineNuxtConfig({
9797
})
9898
```
9999

100+
::note
101+
The most popular LibSQL hosting services is [Turso](https://turso.tech/).
102+
::
103+
100104
## `build`
101105

102106
Nuxt Content read and parse all the available contents at built time. This option let you control over parsing contents.

docs/content/docs/2.collections/1.collections.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ import { defineCollection, z } from '@nuxt/content'
5454

5555
export const collections = {
5656
blog: defineCollection({
57-
source: 'blog/**.md',
57+
source: 'blog/*.md',
5858
type: 'page',
5959
// Define custom schema for docs collection
6060
schema: z.object({

0 commit comments

Comments
 (0)