From 6ee89a1b680132b492f3d437d77dc5990d4b6658 Mon Sep 17 00:00:00 2001
From: magicfelix <felix@felix-zauberer.de>
Date: Wed, 2 Oct 2024 19:59:37 +0200
Subject: [PATCH] Show related blog posts on pages

---
 templates/pages/content.html       |  1 +
 templates/pages/raw.html           |  1 +
 templates/pages/related_posts.html | 16 ++++++++++++++++
 3 files changed, 18 insertions(+)
 create mode 100644 templates/pages/related_posts.html

diff --git a/templates/pages/content.html b/templates/pages/content.html
index 0e4ef051..701ce94e 100644
--- a/templates/pages/content.html
+++ b/templates/pages/content.html
@@ -17,4 +17,5 @@
       {% endblock content %}
     </div>
   </section>
+  {% include "pages/related_posts.html" %}
 {% endblock %}
diff --git a/templates/pages/raw.html b/templates/pages/raw.html
index e2d9395c..085595c5 100644
--- a/templates/pages/raw.html
+++ b/templates/pages/raw.html
@@ -2,4 +2,5 @@
 
 {% block main %}
   {{ page.content | safe }}
+  {% include "pages/related_posts.html" %}
 {% endblock %}
diff --git a/templates/pages/related_posts.html b/templates/pages/related_posts.html
new file mode 100644
index 00000000..26fafd9b
--- /dev/null
+++ b/templates/pages/related_posts.html
@@ -0,0 +1,16 @@
+{% set blog_section = get_section(path="blog/_index.md") %}
+<section class="section" resource="{{ blog_section.permalink }}" typeof="schema:Blog">
+  <meta property="schema:publisher" href="https://teckids.org/" />
+  <div class="container">
+    <h2 class="title is-2">{{ title | default(value="Aus dem Teckids-Blog") }}</h2>
+    <div class="columns is-multiline is-same-height mt-4">
+      {% for post in blog_section.pages %}
+        {% if "aspekt" in post.taxonomies and page.title in post.taxonomies["aspekt"] %}
+          <div class="column is-one-third">
+            {% include "blog/card.html" %}
+          </div>
+	{% else %}{% continue %}{% endif %}
+      {% endfor %}
+    </div>
+  </div>
+</section>
-- 
GitLab