import DirectusToMarkdown from '@resilien/directus-to-markdown' import urlslug from 'url-slug' const filter = process.env.DRAFT && process.env.DRAFT == 'true' ? '' : { draft: { _eq: 'false' } } const config = { contentKey: 'body', collections: { actualites: { readByQueryOption: { fields: ['title', 'slug', 'date', 'image', 'image_credit', 'draft', 'body', 'description'], filter }, pathBuilder: (article) => { if (article.slug) { return `./content/actualites/${article.slug}` } return `./content/actualites/${article.date}-${urlslug(article.title, { remove: /\./g })}`; } } } } new DirectusToMarkdown(config).export();