Skip to content

Commit 80967f4

Browse files
cossssminfarnabaz
andauthored
docs: update source options (#3253)
--------- Co-authored-by: Farnabaz <[email protected]>
1 parent dc27bc9 commit 80967f4

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

docs/content/docs/2.collections/3.sources.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The `source` property can be defined as either a string (following a glob patter
3232
- `source: '**/*.{json,yml}'` includes `JSON` or `YML` file within the content directory and all its subdirectories.
3333
- `source: '*.json'` includes only `JSON` files located directly within the content directory, excluding any subdirectories.
3434

35-
### `include`
35+
### `include` (required)
3636

3737
Glob pattern of your target repository and files in the content folder.
3838

@@ -80,8 +80,44 @@ source: {
8080

8181
### `repository`
8282

83-
External source representing a remote git repository URL (e.g., <https://github.com/nuxt/content>)
83+
External source representing a remote git repository URL (e.g., <https://github.com/nuxt/content>).
84+
85+
When defining an external source you must also define the `include` option.
86+
`include` pattern is essential for the module to know which files to use for the collection.
87+
88+
```js
89+
import { defineCollection, defineContentConfig } from '@nuxt/content'
90+
91+
export default defineContentConfig({
92+
collections: {
93+
docs: defineCollection({
94+
type: 'page'
95+
source: {
96+
repository: 'https://github.com/nuxt/content',
97+
include: 'docs/content/**',
98+
},
99+
})
100+
}
101+
})
102+
```
84103

85104
### `authToken`
86105

87106
Authentication token for private repositories (e.g., GitHub personal access token).
107+
108+
### `authBasic`
109+
110+
Basic authentication for private repositories (e.g., Bitbucket username and password).
111+
112+
```ts
113+
defineCollection({
114+
type: 'page',
115+
source: {
116+
repository: 'https://bitbucket.org/username/repo',
117+
authBasic: {
118+
username: 'username',
119+
password: 'password',
120+
},
121+
},
122+
})
123+
```

0 commit comments

Comments
 (0)