feat: Ajout de pages par Directus

This commit is contained in:
2023-02-22 18:42:32 +01:00
parent 8b8943ab92
commit d92ab6c271
11 changed files with 150 additions and 163 deletions

View File

@ -6,6 +6,35 @@ const filterAssociation = process.env.DRAFT && process.env.DRAFT == 'true' ? ''
const config = {
collections: {
Pages: {
readByQueryOption: {
fields: ['title', 'description', 'slug', 'image', 'image_credit', 'content', 'menu_display', 'sort', 'identifier', 'menu_title', 'parent', 'layout'],
filterDraft
},
pathBuilder: (page) => {
page.path = page.parent ? 'index.md' : '_index.md'
if (!page.layout) delete page.layout
if (!page.image) delete page.image
if (!page.image_credit) delete page.image_credit
if (page.menu_display) {
page.menu = {
main: {
name: page.menu_title,
weight: page.sort
}
}
if (page.identifier) {
page.menu.main.identifier = page.identifier
}
if (page.parent) {
page.menu.main.parent = page.parent
}
}
return `./content${page.slug}`;
},
deleteFields: ['path', 'slug', 'menu_display', 'sort', 'identifier', 'menu_title', 'parent']
},
actualites: {
readByQueryOption: {
fields: ['title', 'date', 'image', 'image_credit', 'description', 'auteur', 'draft', 'content'],