From c3d585908a6038a72e1e479da78c925c0e44a722 Mon Sep 17 00:00:00 2001
From: Alexis BENOIT <alex@noesya.coop>
Date: Tue, 1 Oct 2024 19:00:33 +0200
Subject: [PATCH] Correction des listes de programmes d'un campus (#627)

---
 layouts/partials/locations/diplomas.html | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/layouts/partials/locations/diplomas.html b/layouts/partials/locations/diplomas.html
index 95b0d448..ac840ade 100644
--- a/layouts/partials/locations/diplomas.html
+++ b/layouts/partials/locations/diplomas.html
@@ -1,21 +1,17 @@
-{{/*  Get programs associated to location  */}}
-{{ $programs := .programs }}
 <ul class="diplomas">
 {{ range .diplomas }}
-  {{ $path := .path }}
-  {{ with site.GetPage (printf "/diplomas/%s" .path) }}
+  {{ $diploma := site.GetPage (printf "/diplomas/%s" .path) }}
+  {{ if $diploma }}
     <li>
-      <a href="{{ .Permalink }}" aria-label="{{ i18n "commons.more_aria" (dict "Title" .Title) }}">
-        {{- partial "PrepareHTML" .Title -}}
+      <a href="{{ $diploma.Permalink }}" aria-label="{{ i18n "commons.more_aria" (dict "Title" $diploma.Title) }}">
+        {{- partial "PrepareHTML" $diploma.Title -}}
       </a>
-      {{ if $programs }}
+      {{ with .programs }}
         <div class="content">
           <ol class="programs">
-            {{- range $programs -}}
-              {{ $program := site.GetPage (printf "/programs%s" .) }}
-              {{ if (eq $path $program.Params.diplomas)}}
-                {{- partial "partials/locations/program.html" $program.Params -}}
-              {{ end }}
+            {{- range . -}}
+              {{ $program := site.GetPage (printf "/programs%s" .slug) }}
+              {{- partial "partials/locations/program.html" $program.Params -}}
             {{- end -}}
           </ol>
         </div>
-- 
GitLab