[Content 3] Multiple sources
According to https://content.nuxt.com/docs/collections/sources
Can I create collection with multiple sources? For example:
2 Replies
Hi @FoxCode. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
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:
In this configuration:
1. The first source includes all Markdown files (**/*.md
) from the default content directory.
2. 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:
----------------------<@363971301947342848> Kapa.ai is still learning and improving, please let me know how I did by reacting below.