Skip to content

Commit

Permalink
docs: move to /docs
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Nov 7, 2024
1 parent 8c0693b commit 2f291b6
Show file tree
Hide file tree
Showing 40 changed files with 51 additions and 54 deletions.
4 changes: 2 additions & 2 deletions docs/app/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const links = computed(() => {
return [{
label: 'Docs',
icon: 'i-lucide-book',
to: '/getting-started',
active: route.path.startsWith('/getting-started') || route.path.startsWith('/components'),
to: '/docs/getting-started',
active: route.path.startsWith('/docs'),
}].filter(Boolean)
})
Expand Down
10 changes: 10 additions & 0 deletions docs/app/error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const props = defineProps<{
error: NuxtError
}>()
const route = useRoute()
const appConfig = useAppConfig()
const colorMode = useColorMode()
Expand All @@ -14,6 +15,15 @@ const { data: files } = await useAsyncData('files', () => queryCollectionSearchS
const color = computed(() => colorMode.value === 'dark' ? colors[appConfig.ui.colors.neutral as keyof typeof colors][900] : 'white')
const links = computed(() => {
return [{
label: 'Docs',
icon: 'i-lucide-book',
to: '/docs/getting-started',
active: route.path.startsWith('/docs'),
}].filter(Boolean)
})
useHead({
meta: [
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
Expand Down
2 changes: 1 addition & 1 deletion docs/app/layouts/docs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ContentNavigationItem } from '@nuxt/content'
const nav = inject<Ref<ContentNavigationItem[]>>('navigation')
const navigation = computed(() => nav?.value.filter(item => !item._path.startsWith('/pro')))
const navigation = computed(() => nav?.value.find(item => item.path === '/docs')?.children || [])
</script>

<template>
Expand Down
File renamed without changes.
32 changes: 0 additions & 32 deletions docs/app/pages/roadmap.vue

This file was deleted.

19 changes: 17 additions & 2 deletions docs/content.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
import { defineCollection } from '@nuxt/content'
import { defineCollection, z } from '@nuxt/content'

export const collections = {
docs: defineCollection({
type: 'page',
source: '**',
source: {
path: 'docs/**',
prefix: '/docs',
},
schema: z.object({
links: z.array(z.object({
label: z.string(),
icon: z.string(),
avatar: z.object({
src: z.string(),
alt: z.string(),
}).optional(),
to: z.string(),
target: z.string().optional(),
})).optional(),
}),
}),
}
4 changes: 0 additions & 4 deletions docs/content/1.getting-started/.navigation.yml

This file was deleted.

3 changes: 0 additions & 3 deletions docs/content/3.api/.navigation.yml

This file was deleted.

2 changes: 2 additions & 0 deletions docs/content/docs/1.getting-started/.navigation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
title: Getting Started
icon: i-lucide-square-play
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ The new collections system provides automatic TypeScript types for all your data
:hr

We're excited for you to explore these new capabilities. Dive into our documentation to learn more about integrating the module and implementing best practices in your next project.

## Content V2 Migration

Learn how to migrate from Content v2 to v3 in the [migration guide](/docs/getting-started/migration).
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Here is the list breaking changes in Content v3:
Implementing document driven mode is Content v3 is quite easy. All you need is to create a catch-all page in Nuxt and fetch contents based on route path.


```vue [[...slug\\].vue]
```vue [pages/[...slug\\].vue]
<script lang="ts" setup>
const route = useRoute()
const { data: page } = await useAsyncData(route.path, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title: How To Use
title: Concepts
icon: i-lucide-lightbulb
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions docs/content/docs/3.composables/.navigation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
icon: i-lucide-square-function
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function queryCollection<T extends keyof Collections>(collection: T): Collection

Use the auto-imported `queryCollection` to find contents inside a collection.Here we assume that you havr defined `docs` collection inside `content.config.ts`. If you have not defined any collection, check [How to define a collection](/getting-started/collections#defineCollection).

```vue [[...slug\\].vue]
```vue [pages/[...slug\\].vue]
<script>
const route = useRoute()
const { data: page } = await useAsyncData(route.path, () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function queryCollectionNavigation<T extends keyof PageCollections>(collection:
Use the auto-imported `queryCollectionNavigation` to generate a navigation tree for a specific collection. This is particularly useful for creating dynamic navigation menus or sidebars based on your content structure.


```vue [[...slug\\].vue]
```vue [pages/[...slug\\].vue]
<script setup lang="ts">
const { data } = await useAsyncData('navigation', () => {
return queryCollectionNavigation('docs')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function queryCollectionItemSurroundings<T extends keyof PageCollections>(collec

Use the auto-imported `queryCollectionItemSurroundings` to find the previous and next items relative to a specific content item in a collection. This is particularly useful for creating navigation between related content pages.

```vue [[...slug\\].vue]
```vue [pages/[...slug\\].vue]
<script setup lang="ts">
const { data } = await useAsyncData('surround', () => {
return queryCollectionItemSurroundings('docs', '/foo')
Expand Down Expand Up @@ -46,7 +46,7 @@ Each item in the array is of type `ContentNavigationItem` or `null` if there is
Here's an example of how to use `queryCollectionItemSurroundings` to create a simple navigation between content pages:


```vue [[...slug\\].vue]
```vue [pages/[...slug\\].vue]
<script setup lang="ts">
const { data } = await useAsyncData('surround', () => {
return queryCollectionItemSurroundings('docs', '/foo', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Generate searchable sections from the specified collection.
Here's an example of how to use `queryCollectionSearchSections` to create searchable sections from the 'docs' collection:


```vue [[...slug\\].vue]
```vue [pages/[...slug\\].vue]
<script>
const { data: surround } = await useAsyncData('foo-surround', () => {
return queryCollectionSearchSections('docs', {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
title: Components
navigation:
icon: i-lucide-blocks
icon: i-lucide-square-code
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The `<ContentRenderer>` component renders a document coming from a query with [`

## Example

```vue [[...slug\\].vue]
```vue [pages/[...slug\\].vue]
<script lang="ts" setup>
const route = useRoute()
const { data: page } = await useAsyncData(route.path, () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
title: 'Prose Components'
description: 'A list of Prose components.'
links:
- label: 'Content Renderer'
icon: 'i-lucide-square-text'
to: '/components/content-renderer'
---

Prose component are replacements for HTML typography tags. Prose components provides simple way to customize content UI. To overwrite a prose component, create a component with the same name in your project `components/content/` directory (ex: `components/content/ProseA.vue`)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default defineNuxtConfig({
},

routeRules: {
'/': { redirect: '/getting-started', prerender: false },
'/': { redirect: '/docs/getting-started', prerender: false },
},

future: {
Expand Down

0 comments on commit 2f291b6

Please sign in to comment.