From ebce559db71829b55912fb1f1d70dcfc1405128d Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Mon, 12 Dec 2022 11:10:17 +0100
Subject: [PATCH] do not show absent users

---
 layouts/partials/persons/list-specific.html | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/layouts/partials/persons/list-specific.html b/layouts/partials/persons/list-specific.html
index 65a16fe4..354c3a40 100644
--- a/layouts/partials/persons/list-specific.html
+++ b/layouts/partials/persons/list-specific.html
@@ -1,13 +1,18 @@
 <ol class="persons">
   {{ range (.Paginate (.Pages.ByParam "last_name")).Pages }}
-    {{ $person := site.GetPage (printf "/persons/%s" .Slug) }}
-    {{ with $person }}
-      <li>
-        <p class="name"><a href="{{ .Permalink }}">{{ partial "PrepareHTML" .Title }}</a></p>
-        {{- if partial "GetTextFromHTML" .Params.description_short }}
-          <p>{{- partial "PrepareHTML" .Params.description_short -}}</p>
-        {{ end -}}
-      </li>
+    {{ if .Slug }}
+      {{ $slug := printf "/persons/%s" .Slug }}
+      {{ $person := site.GetPage $slug }}
+      {{ if $person }}
+        {{ with $person }}
+          <li>
+            <p class="name"><a href="{{ .Permalink }}">{{ partial "PrepareHTML" .Title }}</a></p>
+            {{- if partial "GetTextFromHTML" .Params.description_short }}
+              <p>{{- partial "PrepareHTML" .Params.description_short -}}</p>
+            {{ end -}}
+          </li>
+        {{ end }}
+      {{ end }}
     {{ end }}
   {{ end }}
 </ol>
-- 
GitLab