lestoitsduval/scripts/directus-to-markdown/index.js

23 lines
622 B
JavaScript

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