22 lines
664 B
JavaScript
22 lines
664 B
JavaScript
|
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 = {
|
||
|
collections: {
|
||
|
actualites: {
|
||
|
readManyOption: {
|
||
|
fields: ['title', 'date', 'image', 'image_credit', 'description', 'auteur', 'draft', 'content'],
|
||
|
filter
|
||
|
},
|
||
|
pathBuilder: (article) => {
|
||
|
const [year, month, day] = article.date.split("-")
|
||
|
return `./content/actualites/${year}/${month}/${day}-${urlslug(article.title, { remove: /\./g })}`;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
new DirectusToMarkdown(config).export();
|