diff --git a/layouts/associations/single.html b/layouts/associations/single.html index fa48883..de73591 100644 --- a/layouts/associations/single.html +++ b/layouts/associations/single.html @@ -10,9 +10,9 @@

Liens :

diff --git a/scripts/directus-to-markdown/index.js b/scripts/directus-to-markdown/index.js index 849cfe5..bedb755 100644 --- a/scripts/directus-to-markdown/index.js +++ b/scripts/directus-to-markdown/index.js @@ -34,23 +34,28 @@ const config = { if (!association.title) { association.title = association.denomination } - const bureau = [] - for (const contact of association.bureau) { - const detail = contact.Contact_id - let c = { - denomination: detail.denomination, - prenom: detail.prenom, - nom: detail.nom, + if (association.bureau && association.bureau.length > 0) { + console.log(association.bureau.length) + const bureau = [] + for (const contact of association.bureau) { + const detail = contact.Contact_id + let c = { + denomination: detail.denomination, + prenom: detail.prenom, + nom: detail.nom, + } + if (detail.mail && detail.display_mail) { + c.mail = detail.mail + } + if (detail.telephone && detail.display_telephone) { + c.telephone = detail.telephone + } + bureau.push(c) } - if (detail.mail && detail.display_mail) { - c.mail = detail.mail - } - if (detail.telephone && detail.display_telephone) { - c.telephone = detail.telephone - } - bureau.push(c) + association.bureau = bureau + } else { + delete association.bureau } - association.bureau = bureau return `./content/associations/${urlslug(association.denomination)}`; },