From 5e171987c134d83469921f50081fd2ccdcb97084 Mon Sep 17 00:00:00 2001
From: Fredrik Jonsson <frjo@xdeb.org>
Date: Wed, 6 Jul 2022 08:27:11 +0200
Subject: [PATCH] Check if related page exist before trying to render it.

---
 hypha/templates/includes/relatedcontent_card.html | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hypha/templates/includes/relatedcontent_card.html b/hypha/templates/includes/relatedcontent_card.html
index ed296408d..04f828071 100644
--- a/hypha/templates/includes/relatedcontent_card.html
+++ b/hypha/templates/includes/relatedcontent_card.html
@@ -1,6 +1,7 @@
 {% load i18n wagtailcore_tags wagtailimages_tags %}
 
 {% with page=page.specific %}
+{% if page %}
 <a class="card" href="{% pageurl page %}">
     <h6 class="card__subheading">
         {% if page.is_open %}
@@ -21,4 +22,5 @@
     {% endif %}
     <svg class="icon icon--card-pixels"><use xlink:href="#arrow-head-pixels--transparent"></use></svg>
 </a>
+{% endif %}
 {% endwith %}
-- 
GitLab