Yes, you can create a collection with multiple sources in Nuxt Content v3. According to the Collections Sources documentation, you can define multiple sources for your collections in the content.config.ts file.
However, the syntax in your example is not quite correct. Here's the correct way to define multiple sources for a collection:
import { defineCollection, defineContentConfig } from '@nuxt/content'
import path from 'path'
export default defineContentConfig({
collections: {
posts: defineCollection({
source: [
{
include: '**/*.md'
},
{
cwd: path.resolve('packages/my-pkg/docs'),
include: '**/*.md'
}
]
})
}
})
In this configuration:
- The first source includes all Markdown files (
**/*.md) from the default content directory.
- The second source includes all Markdown files from a custom directory (
packages/my-pkg/docs).
This setup allows you to combine content from different locations into a single collection, which can be very useful for organizing and managing your content across various parts of your project.
Remember to adjust the paths according to your project structure. Also, make sure to import the necessary functions (defineCollection, defineContentConfig) from '@nuxt/content' and path from Node.js if you're using path.resolve().
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: