feat: Ajout de pages par Directus
This commit is contained in:
@ -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'],
|
||||
|
Reference in New Issue
Block a user