Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update sources #1664

Merged
merged 3 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions docs/content/4.api/3.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ The watcher is a development feature and will not be included in production.

## `sources`

- Type: `Array<Object | String>`{lang=ts}
- Default: `['content']`{lang=ts}
- Type: `Record<String, Object>`{lang=ts}
- Default: `{}`{lang=ts}

Define different sources for contents.

Expand All @@ -82,20 +82,29 @@ Contents can be located in multiple places, in multiple directories, or in remot
```ts [nuxt.config.ts]
export default defineNuxtConfig({
content: {
sources: [
'content',
{
name: 'fa-ir',
sources: {
// overwrite default source AKA `content` directory
content: {
driver: 'fs',
prefix: '/docs', // All contents inside this source will be prefixed with `/docs`
base: resolve(__dirname, 'content')
}
// Additional sources
fa: {
prefix: '/fa', // All contents inside this source will be prefixed with `/fa`
driver: 'fs',
// ...driverOptions
base: resolve(__dirname, 'content-fa') // Path for source directory
}
]
}
}
})
```

::Alert
It is highly recommended to prevent modifying default source. If you want to load contents from another location, consider adding an additional source.
::

## `ignores`

- Type: `string[] | object[]`{lang=ts}
Expand Down
4 changes: 0 additions & 4 deletions docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,21 @@ export default defineNuxtConfig({
content: {
sources: {
v1: {
name: 'v1',
prefix: '/v1',
driver: 'fs',
base: resolve(__dirname, 'content-v1/en')
},
'v1-ja': {
name: 'v1-ja',
prefix: '/ja/v1',
driver: 'fs',
base: resolve(__dirname, 'content-v1/ja')
},
'v1-fr': {
name: 'v1-fr',
prefix: '/fr/v1',
driver: 'fs',
base: resolve(__dirname, 'content-v1/fr')
},
'v1-ru': {
name: 'v1-ru',
prefix: '/ru/v1',
driver: 'fs',
base: resolve(__dirname, 'content-v1/ru')
Expand Down