From afdb3ec94024fef5424e3a9b5f0f2197824562fe Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Tue, 12 Mar 2024 15:51:27 +0100
Subject: [PATCH] Move blog card into includable template

---
 templates/blog/card.html             | 20 ++++++++++++++++++++
 templates/frontpage/blocks/blog.html | 20 +-------------------
 2 files changed, 21 insertions(+), 19 deletions(-)
 create mode 100644 templates/blog/card.html

diff --git a/templates/blog/card.html b/templates/blog/card.html
new file mode 100644
index 00000000..1ea0a09b
--- /dev/null
+++ b/templates/blog/card.html
@@ -0,0 +1,20 @@
+          <div class="card">
+            <div class="card-image">
+              <figure class="image is-4by3">
+                <a href="{{ post.permalink }}"><img src="{{ get_url(path="@/" ~ post.relative_path, trailing_slash=true) }}{{ post.extra.depiction.image | safe }}" alt="{{ post.extra.depiction.alt }}" /></a>
+              </figure>
+            </div>
+            <div class="card-content">
+              <a href="{{ post.permalink }}"><h3 class="title is-3">{{ post.title }}</h3></a>
+              <p class="subtitle">
+                {{ post.date }} ·
+                {% for author in post.authors %}
+                  {{ author }}
+                {% endfor %}
+              </p>
+              <div class="content">
+                {{ post.summary | safe }}
+              </div>
+            </div>
+          </div>
+
diff --git a/templates/frontpage/blocks/blog.html b/templates/frontpage/blocks/blog.html
index 37abf0e1..7468261c 100644
--- a/templates/frontpage/blocks/blog.html
+++ b/templates/frontpage/blocks/blog.html
@@ -5,25 +5,7 @@
     <div class="columns is-multiline is-same-height">
       {% for post in blog_section.pages | slice(end=4) %}
         <div class="column is-one-quarter">
-          <div class="card">
-            <div class="card-image">
-              <figure class="image is-4by3">
-                <a href="{{ post.permalink }}"><img src="{{ get_url(path="@/" ~ post.relative_path, trailing_slash=true) }}{{ post.extra.depiction.image | safe }}" alt="{{ post.extra.depiction.alt }}" /></a>
-              </figure>
-            </div>
-            <div class="card-content">
-              <a href="{{ post.permalink }}"><h3 class="title is-3">{{ post.title }}</h3></a>
-              <p class="subtitle">
-                {{ post.date }} ·
-                {% for author in post.authors %}
-                  {{ author }}
-                {% endfor %}
-              </p>
-              <div class="content">
-                {{ post.summary | safe }}
-              </div>
-            </div>
-          </div>
+          {% include "blog/card.html" %}
         </div>
       {% endfor %}
     </div>
-- 
GitLab