From a6b0a757c232d086b5c305efe801e9e29f6a04fd Mon Sep 17 00:00:00 2001 From: Jalil Arfaoui Date: Sat, 12 Oct 2024 16:40:36 +0200 Subject: [PATCH] feat: ajout de la boutique dans le menu --- src/_includes/header.njk | 2 +- src/boutique.md | 6 ++++++ src/filters/index.js | 2 ++ src/filters/targetBlankForExternalLinks.js | 6 ++++++ src/infos/chiffres.md | 3 --- src/infos/droit.md | 3 --- src/ressources/index.md | 5 +++++ 7 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 src/boutique.md create mode 100644 src/filters/targetBlankForExternalLinks.js diff --git a/src/_includes/header.njk b/src/_includes/header.njk index 70873ac..5a53d26 100644 --- a/src/_includes/header.njk +++ b/src/_includes/header.njk @@ -17,6 +17,6 @@ } %} - {{ collections.all | eleventyNavigation | eleventyNavigationToHtml(navigationOptions) | safe }} + {{ collections.all | eleventyNavigation | eleventyNavigationToHtml(navigationOptions) | targetBlankForExternalLinks |safe }} diff --git a/src/boutique.md b/src/boutique.md new file mode 100644 index 0000000..539975c --- /dev/null +++ b/src/boutique.md @@ -0,0 +1,6 @@ +--- +eleventyNavigation: + key: Boutique + url: https://nonscollectif.myspreadshop.fr/ + order: 9 +--- diff --git a/src/filters/index.js b/src/filters/index.js index 8f8a4dc..8f3eeb6 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -1,7 +1,9 @@ const mediaLogo = require('./mediaLogo') const mediaName = require('./mediaName') +const targetBlankForExternalLinks = require('./targetBlankForExternalLinks') module.exports = function(eleventyConfig) { eleventyConfig.addFilter('mediaLogo', mediaLogo) eleventyConfig.addFilter('mediaName', mediaName) + eleventyConfig.addFilter("targetBlankForExternalLinks", targetBlankForExternalLinks) } diff --git a/src/filters/targetBlankForExternalLinks.js b/src/filters/targetBlankForExternalLinks.js new file mode 100644 index 0000000..571ab92 --- /dev/null +++ b/src/filters/targetBlankForExternalLinks.js @@ -0,0 +1,6 @@ +function targetBlankForExternalLinks (url) { + const anchorRegex = /(href="https?:[^"]+")/g; + return url.replace(anchorRegex, '$1 target="_blank"'); +} + +module.exports = targetBlankForExternalLinks diff --git a/src/infos/chiffres.md b/src/infos/chiffres.md index c42c691..b993738 100644 --- a/src/infos/chiffres.md +++ b/src/infos/chiffres.md @@ -2,9 +2,6 @@ title: L'instruction en famille en France - Chiffres description: "53 000 enfants instruits hors école : raisons de santé, modes de vie itinérants, pédagogies alternatives, choix de vie …" permalink: /Chiffres/ -eleventyNavigation: - key: Chiffres - order: 3 --- ## Suivi des demandes - Septembre 2024 diff --git a/src/infos/droit.md b/src/infos/droit.md index 6b6eb31..d488b79 100644 --- a/src/infos/droit.md +++ b/src/infos/droit.md @@ -4,9 +4,6 @@ description: L'école est-elle obligatoire ? Que dit la loi sur l'instruction en date: 2022-07-26 modified: 2022-07-26 permalink: /droit/ -eleventyNavigation: - key: La loi - order: 4 --- ## Que disait la loi avant 2022 ? diff --git a/src/ressources/index.md b/src/ressources/index.md index dccb58f..62ee908 100644 --- a/src/ressources/index.md +++ b/src/ressources/index.md @@ -8,6 +8,11 @@ eleventyNavigation: order: 8 --- + +[Le droit](/droit/){.button .mx-auto target=_blank style="display:inline-block"} +[Les chiffres](/Chiffres/){.button .mx-auto target=_blank style="display:inline-block"} + + ## Nos ressources en accès libre ### Suivi des demandes - Septembre 2024