diff --git a/docs/content/docs/2.collections/2.types.md b/docs/content/docs/2.collections/2.types.md
index b03e50f2c..dfaa77ccf 100644
--- a/docs/content/docs/2.collections/2.types.md
+++ b/docs/content/docs/2.collections/2.types.md
@@ -101,12 +101,12 @@ defineCollection({
})
```
-The data type is useful for content that doesn’t directly correspond to a webpage but instead represents structured data you might want to query and display within your application.
+The data type is useful for content that doesn't directly correspond to a webpage but instead represents structured data you might want to query and display within your application.
With data collections, you have complete control over the schema, allowing you to define custom structures.
::note
-There’s no strict relationship between collection type and file extension. For instance, a **page** collection can use [Markdown](/docs/files/markdown) or [YAML](/docs/files/yaml) or [JSON](/docs/files/json) files, and **data** collections can use any of these formats as well.
+There's no strict relationship between collection type and file extension. For instance, a **page** collection can use [Markdown](/docs/files/markdown) or [YAML](/docs/files/yaml) or [JSON](/docs/files/json) files, and **data** collections can use any of these formats as well.
::
## Ordering Files
diff --git a/docs/content/docs/2.collections/3.sources.md b/docs/content/docs/2.collections/3.sources.md
index 8f8e7069b..b51f6de2e 100644
--- a/docs/content/docs/2.collections/3.sources.md
+++ b/docs/content/docs/2.collections/3.sources.md
@@ -91,7 +91,7 @@ import { defineCollection, defineContentConfig } from '@nuxt/content'
export default defineContentConfig({
collections: {
docs: defineCollection({
- type: 'page'
+ type: 'page',
source: {
repository: 'https://github.com/nuxt/content',
include: 'docs/content/**',
@@ -105,6 +105,10 @@ export default defineContentConfig({
Authentication token for private repositories (e.g., GitHub personal access token).
+::warning{icon="i-lucide-shield-alert"}
+Never commit authentication tokens or credentials directly in your code. Use environment variables or other secure methods to provide these values at runtime.
+::
+
### `authBasic`
Basic authentication for private repositories (e.g., Bitbucket username and password).
diff --git a/docs/content/docs/3.files/4.csv.md b/docs/content/docs/3.files/4.csv.md
new file mode 100644
index 000000000..e8f6f0233
--- /dev/null
+++ b/docs/content/docs/3.files/4.csv.md
@@ -0,0 +1,97 @@
+---
+title: CSV
+description: How to define, write and query CSV data.
+---
+
+Nuxt Content supports CSV files out of the box. You can store and query data in CSV format, with options for JSON conversion and custom delimiters.
+
+## Configuration
+
+You can configure how CSV files are parsed in your `nuxt.config.ts`:
+
+```ts [nuxt.config.ts]
+export default defineNuxtConfig({
+ content: {
+ build: {
+ csv: {
+ // Convert CSV data to JSON objects
+ json: true,
+ // Specify custom delimiter (default is ',')
+ delimiter: ','
+ }
+ }
+ }
+})
+```
+
+## Example Usage
+
+Create a CSV file in your content directory:
+
+```csv [content/users.csv]
+id,name,email
+1,John Doe,john@example.com
+2,Jane Smith,jane@example.com
+```
+
+Query the data in your components:
+
+```vue
+
+
+
+
+ -
+ {{ user.name }} ({{ user.email }})
+
+
+
+```
+
+With `json: true` in the configuration, each row will be converted to a JavaScript object with the header row used as keys:
+
+```json
+[
+ {
+ "id": "1",
+ "name": "John Doe",
+ "email": "john@example.com"
+ },
+ {
+ "id": "2",
+ "name": "Jane Smith",
+ "email": "jane@example.com"
+ }
+]
+```
+
+## Custom Delimiters
+
+If your CSV files use a different delimiter, you can specify it in the configuration:
+
+```ts [nuxt.config.ts]
+export default defineNuxtConfig({
+ content: {
+ build: {
+ csv: {
+ delimiter: ';' // Use semicolon as delimiter
+ }
+ }
+ }
+})
+```
+
+This would parse CSV files like:
+
+```csv
+id;name;email
+1;John Doe;john@example.com
+```
+
+::note
+The CSV parser can be disabled by setting `csv: false` in the configuration if you don't need CSV support.
+::
\ No newline at end of file
diff --git a/playground/app.vue b/playground/app.vue
index 55d946fe1..e587fb6a9 100644
--- a/playground/app.vue
+++ b/playground/app.vue
@@ -38,7 +38,7 @@ const items = ref([
{
label: 'Data',
icon: 'i-lucide-folder-open',
- to: '/data',
+ to: '/data/foo',
},
])
diff --git a/playground/components/ContentPage.vue b/playground/components/ContentPage.vue
index ce70bd371..2c1a58821 100644
--- a/playground/components/ContentPage.vue
+++ b/playground/components/ContentPage.vue
@@ -65,7 +65,10 @@ const bodyTocLinksWithDebug = computed(() => {
/>
+ {{ data.body }}
+
diff --git a/playground/content/csv.csv b/playground/content/csv.csv
new file mode 100644
index 000000000..044e5fa61
--- /dev/null
+++ b/playground/content/csv.csv
@@ -0,0 +1,2 @@
+name,age,gender
+joseph,33,male
\ No newline at end of file
diff --git a/playground/content/yml.yml b/playground/content/yml.yml
new file mode 100644
index 000000000..d277b6915
--- /dev/null
+++ b/playground/content/yml.yml
@@ -0,0 +1,19 @@
+company: spacelift
+domain:
+ - devops
+ - devsecops
+tutorial:
+ - yaml:
+ name: "YAML Ain't Markup Language"
+ type: awesome
+ born: 2001
+ - json:
+ name: JavaScript Object Notation
+ type: great
+ born: 2001
+ - xml:
+ name: Extensible Markup Language
+ type: good
+ born: 1996
+author: omkarbirade
+published: true
diff --git a/playground/pages/data/[...slug].vue b/playground/pages/data/[...slug].vue
index f71159b3d..64a6918d6 100644
--- a/playground/pages/data/[...slug].vue
+++ b/playground/pages/data/[...slug].vue
@@ -1,6 +1,6 @@
diff --git a/playground/pages/vue/[...slug].vue b/playground/pages/vue/[...slug].vue
index 4a5fb5192..a5d2dd554 100644
--- a/playground/pages/vue/[...slug].vue
+++ b/playground/pages/vue/[...slug].vue
@@ -18,7 +18,7 @@ const { data: surround } = await useAsyncData('vue-docs-surround' + route.path,
diff --git a/src/module.ts b/src/module.ts
index 7ade14d9a..9032208b8 100644
--- a/src/module.ts
+++ b/src/module.ts
@@ -77,7 +77,7 @@ export default defineNuxtModule({
markdown: {},
yaml: {},
csv: {
- delimeter: ',',
+ delimiter: ',',
json: true,
},
},
diff --git a/src/types/module.ts b/src/types/module.ts
index 72b4559f1..f5f44ff7a 100644
--- a/src/types/module.ts
+++ b/src/types/module.ts
@@ -176,7 +176,7 @@ export interface ModuleOptions {
*/
csv?: false | {
json?: boolean
- delimeter?: string
+ delimiter?: string
}
}