From d859582e5327c13172c504cd86080663e5e94f21 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Tue, 14 Jan 2025 14:04:58 +0100 Subject: [PATCH] Add formations --- _data/formations.js | 12 +++++++ _includes/components/card_formation.njk | 48 +++++++++++++++++++++++++ content/fr/formations/index.njk | 30 ++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 _data/formations.js create mode 100644 _includes/components/card_formation.njk create mode 100644 content/fr/formations/index.njk diff --git a/_data/formations.js b/_data/formations.js new file mode 100644 index 0000000..89545bf --- /dev/null +++ b/_data/formations.js @@ -0,0 +1,12 @@ +const EleventyFetch = require("@11ty/eleventy-fetch"); + +module.exports = async function () { + const URL = "https://code.gouv.fr/data/formations-logiciels-libres.json"; + + let formations = await EleventyFetch(URL, { + duration: "2w", + type: "json" + }); + + return formations; +}; diff --git a/_includes/components/card_formation.njk b/_includes/components/card_formation.njk new file mode 100644 index 0000000..5b56e1e --- /dev/null +++ b/_includes/components/card_formation.njk @@ -0,0 +1,48 @@ +{% if not card %}{% set card = params %}{% endif %} +
+
+
+

+ + {{ card.title }} + +

+

{{ card.description }}

+ +
+
Formations
+
    + {% for f in card.formations %} + {% if loop.index0 < 3 %} +
  • {{ f }}
  • + {% endif %} + {% endfor %} +
  • ...
  • +
+

{{ card.detailEnd }}

+
+
+
+ {% if card.badges or card.image %} +
+ {% if card.badges %} +
    + {% for badge in card.badges %} +
  • {{ badge }}

  • + {% endfor %} +
+ {% endif %} + {% if card.image %} + {% if card.image.path %} +
{% imageSync card.image.path, card.image.alt %}
+ {% elif card.image.src %} +
+ {{ card.image.alt }} +
+ {% endif %} + {% endif %} +
+ {% endif %} +
diff --git a/content/fr/formations/index.njk b/content/fr/formations/index.njk new file mode 100644 index 0000000..f3407fc --- /dev/null +++ b/content/fr/formations/index.njk @@ -0,0 +1,30 @@ +--- +title: "Offre de formations logiciels libres" +description: Liste des formations logiciels libres par des organismes français +layout: layouts/page.njk +eleventyNavigation: + key: "Formations logiciels libres" + parent: Ressources + order: 5 +--- + +{% from "components/component.njk" import component with context %} +{{ component("callout", { + title: "Formations logiciels libres", + description: 'Sollicitez-nous pour être référencés.' | safe +}) }} +
+
+ {% asyncAll formation in formations %} +
+ {{ component("card_formation", { + externalUrl: formation.site_web, + title: formation.organisme, + description: formation.description, + formations: formation.formations, + email: formation.courriel + }) }} +
+ {% endall %} +
+