From 9386fe8c132944d001884630ed4e931e37c828c4 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Fri, 5 Jun 2020 11:25:07 +0200 Subject: Add section template. Also move most content to the section templates, leave only section descriptions and the latest posts in each for the index page. --- templates/index.html | 78 +++++++++++++++++++------------------------------- templates/section.html | 44 ++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 48 deletions(-) create mode 100644 templates/section.html diff --git a/templates/index.html b/templates/index.html index a712ac4..08beb0a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,53 +1,35 @@ {% extends "base.html" %} {% block content %} -
-
- {{ section.content | safe }} -
+
+ {{ section.content | safe }} +
- -
+
+ {% for sub in section.subsections %} + {% set s = get_section(path=sub) %} +
+
+

{{ s.title }}

+
+ {{ s.description | markdown | safe }} +
+
+
+

Siste innlegg:

+
    + {% for post in s.pages | reverse %} +
  • + {{ post.date }}: + + {{ post.title }} + +
  • + {% if loop.index == 5 %}{% break %}{% endif %} + {% endfor %} +
+
+
+ {% endfor %} +
{% endblock content %} diff --git a/templates/section.html b/templates/section.html new file mode 100644 index 0000000..b65fdf1 --- /dev/null +++ b/templates/section.html @@ -0,0 +1,44 @@ +{% extends "base.html" %} +{% block content %} +

{{ section.title }}

+ +{{ section.description }} + +
+ {% for post in section.pages | reverse %} +
+
+ +

+ + {{ post.title }} + +

+
+
+ {% if post.summary %} + {{ post.summary | safe }} + {% else %} + {{ post.content | safe }} + {% endif %} +
+ +
+ {% endfor %} +
+{% endblock content %} -- cgit v1.2.3