From 8d768caea91aa59e241ffb3cf48b2c31d04b1e1b Mon Sep 17 00:00:00 2001
From: peter_rabbit <pierrejarriges@gmail.com>
Date: Tue, 2 Feb 2021 16:40:35 +0100
Subject: [PATCH] feat og image array

---
 build.js                               | 14 ++++++++++++--
 public/education/index.html            |  5 +++--
 public/games/index.html                |  7 +++++--
 public/software-development/index.html |  5 +++--
 src/pages/games/meta.json              |  7 ++++++-
 5 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/build.js b/build.js
index 6f230d7..4638f9b 100644
--- a/build.js
+++ b/build.js
@@ -99,10 +99,20 @@ function getPageHtml(pageName, pageMeta) {
             const { key, defaultValue } = entry;
             html = html.replace(
                 html.match(getOgMetaSearchRegex(key)),
-                `<meta property="og:${key}" content="${pageOgMeta[key] || defaultValue}"/>`
+                (function () {
+                    const customValue = pageOgMeta[key];
+                    if (!customValue)
+                        return `<meta property="og:${key}" content="${defaultValue}"/>`;
+                    else {
+                        return Array.isArray(customValue)
+                            ? customValue
+                                  .map(alt => `<meta property="og:${key}" content="${alt}"/>`)
+                                  .join("\n")
+                            : `<meta property="og:${key}" content="${customValue}"/>`;
+                    }
+                })()
             );
         });
-
         const additionalOgMeta = Object.keys(pageMeta.open_graph).filter(
             k => !requiredOgMeta.map(rom => rom.key).includes(k)
         );
diff --git a/public/education/index.html b/public/education/index.html
index 9683037..e7fcc43 100644
--- a/public/education/index.html
+++ b/public/education/index.html
@@ -5,15 +5,16 @@
         <title>Kuadrado Software | Pédagogie</title>
         <meta name="description" content="Animations autour de la création de jeux vidéos, vulgarisation numérique. Découvrez nos initiatives pédagogiques."/>
         <meta name="author" content="Kuadrado Software" />
-        <meta name="image" content="https://kuadrado-software.fr/assets/images/brain.svg"/>
+        <meta name="image" content="https://kuadrado-software.fr/assets/images/brain.png"/>
 
         <!-- Open Graph Protocol meta data -->
         <meta property="og:title" content="Kuadrado Software | Pédagogie"/>
         <meta property="og:description" content="Animations autour de la création de jeux vidéos, vulgarisation numérique. Découvrez nos initiatives pédagogiques."/>
         <meta property="og:type" content="website" />
         <meta property="og:url" content="https://kuadrado-software.fr/education"/>
-        <meta property="og:image" content="https://kuadrado-software.fr/assets/images/brain.svg"/>
+        <meta property="og:image" content="https://kuadrado-software.fr/assets/images/brain.png"/>
         <meta property="og:locale" content="fr_FR"/>
+        <meta property="og:site_name" content="Kuadrado Software"/>
 
         <!-- English translation not ready yet -->
         <!-- <meta property="og:locale:alternate" content="en_GB" /> -->
diff --git a/public/games/index.html b/public/games/index.html
index f31754e..aa3a2ed 100644
--- a/public/games/index.html
+++ b/public/games/index.html
@@ -5,15 +5,18 @@
         <title>Kuadrado Software | Jeux</title>
         <meta name="description" content="Création de jeux vidéos indépendants. Jeux web, PC et projets en cours de développement"/>
         <meta name="author" content="Kuadrado Software" />
-        <meta name="image" content="https://kuadrado-software.fr/assets/images/game_controller.svg"/>
+        <meta name="image" content="https://kuadrado-software.fr/assets/images/game_controller.png"/>
 
         <!-- Open Graph Protocol meta data -->
         <meta property="og:title" content="Kuadrado Software | Jeux"/>
         <meta property="og:description" content="Création de jeux vidéos indépendants. Jeux web, PC et projets en cours de développement"/>
         <meta property="og:type" content="website" />
         <meta property="og:url" content="https://kuadrado-software.fr/games"/>
-        <meta property="og:image" content="https://kuadrado-software.fr/assets/images/game_controller.svg"/>
+        <meta property="og:image" content="https://kuadrado-software.fr/assets/images/game_controller.png"/>
+<meta property="og:image" content="https://kuadrado-software.fr/assets/images/game_studio_banner.png"/>
+<meta property="og:image" content="https://kuadrado-software.fr/assets/images/popularization_banner.png"/>
         <meta property="og:locale" content="fr_FR"/>
+        <meta property="og:site_name" content="Kuadrado Software"/>
 
         <!-- English translation not ready yet -->
         <!-- <meta property="og:locale:alternate" content="en_GB" /> -->
diff --git a/public/software-development/index.html b/public/software-development/index.html
index 26bea0e..9e5d2f7 100644
--- a/public/software-development/index.html
+++ b/public/software-development/index.html
@@ -5,15 +5,16 @@
         <title>Kuadrado Software | Software</title>
         <meta name="description" content="Développement web, moteur de jeux, outillage logiciel, retrouvez nos projets en détail."/>
         <meta name="author" content="Kuadrado Software" />
-        <meta name="image" content="https://kuadrado-software.fr/assets/images/meca_proc.svg"/>
+        <meta name="image" content="https://kuadrado-software.fr/assets/images/meca_proc.png"/>
 
         <!-- Open Graph Protocol meta data -->
         <meta property="og:title" content="Kuadrado Software | Software"/>
         <meta property="og:description" content="Développement web, moteur de jeux, outillage logiciel, retrouvez nos projets en détail."/>
         <meta property="og:type" content="website" />
         <meta property="og:url" content="https://kuadrado-software.fr/software-development"/>
-        <meta property="og:image" content="https://kuadrado-software.fr/assets/images/meca_proc.svg"/>
+        <meta property="og:image" content="https://kuadrado-software.fr/assets/images/meca_proc.png"/>
         <meta property="og:locale" content="fr_FR"/>
+        <meta property="og:site_name" content="Kuadrado Software"/>
 
         <!-- English translation not ready yet -->
         <!-- <meta property="og:locale:alternate" content="en_GB" /> -->
diff --git a/src/pages/games/meta.json b/src/pages/games/meta.json
index 25ba56c..794d9d7 100644
--- a/src/pages/games/meta.json
+++ b/src/pages/games/meta.json
@@ -4,6 +4,11 @@
     "image": "https://kuadrado-software.fr/assets/images/game_controller.png",
     "open_graph": {
         "title": "Kuadrado Software | Jeux",
-        "description": "Création de jeux vidéos indépendants. Jeux web, PC et projets en cours de développement"
+        "description": "Création de jeux vidéos indépendants. Jeux web, PC et projets en cours de développement",
+        "image": [
+            "https://kuadrado-software.fr/assets/images/game_controller.png",
+            "https://kuadrado-software.fr/assets/images/game_studio_banner.png",
+            "https://kuadrado-software.fr/assets/images/popularization_banner.png"
+        ]
     }
 }
-- 
GitLab