Nuxt content exclude files

how to exclude files in content folder in Nuxt content
2 Replies
kapa.ai
kapa.ai2mo ago
Hi @Muhammad Khizar. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To exclude files in the content folder when using Nuxt Content, you should use the exclude option in your collection’s source configuration within content.config.ts. This allows you to specify glob patterns for files or folders you want to ignore. Example: Exclude all dotfiles
defineCollection({
source: {
include: '**',
exclude: ['**/.*']
}
})
defineCollection({
source: {
include: '**',
exclude: ['**/.*']
}
})
This will exclude all files starting with a dot (e.g., .DS_Store, .gitignore) from being processed by Nuxt Content. Example: Exclude all dotfiles except .navigation.yml
defineCollection({
source: {
include: '**',
exclude: ['**/.!(navigation.yml)']
}
})
defineCollection({
source: {
include: '**',
exclude: ['**/.!(navigation.yml)']
}
})
This pattern excludes all dotfiles except for .navigation.yml files, which are often used for navigation configuration in Nuxt Content. You can use any glob pattern to match the files or folders you want to exclude. For more advanced usage, refer to the source property documentation and the migration guide on ignoring dot files.
Note: If you add a content.config.ts file, only files matching the specified path patterns defined in collections will be imported. All others will be excluded by default unless included explicitly Defining Collections.
---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@1079765697753784431> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?