2022-01-27 17:51:50 +01:00
|
|
|
import DirectusToMarkdown from '@resilien/directus-to-markdown'
|
|
|
|
import urlslug from 'url-slug'
|
|
|
|
|
2022-01-29 14:08:44 +01:00
|
|
|
const filter = process.env.DRAFT && process.env.DRAFT == 'true' ? '' : { draft: { _eq: 'false' } }
|
|
|
|
|
2022-01-27 17:51:50 +01:00
|
|
|
const config = {
|
|
|
|
contentKey: 'body',
|
|
|
|
collections: {
|
|
|
|
actualites: {
|
2022-02-21 18:15:07 +01:00
|
|
|
readByQueryOption: {
|
2022-11-28 09:33:55 +01:00
|
|
|
fields: ['title', 'slug', 'date', 'image', 'image_credit', 'draft', 'body', 'description'],
|
2022-01-29 14:08:44 +01:00
|
|
|
filter
|
2022-01-27 17:51:50 +01:00
|
|
|
},
|
|
|
|
pathBuilder: (article) => {
|
|
|
|
if (article.slug) {
|
|
|
|
return `./content/actualites/${article.slug}`
|
|
|
|
}
|
|
|
|
return `./content/actualites/${article.date}-${urlslug(article.title, { remove: /\./g })}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
new DirectusToMarkdown(config).export();
|