From 4276c2ad777f8f48a6ee9f7610add639757453a1 Mon Sep 17 00:00:00 2001 From: Pablo Silva Date: Sun, 26 May 2024 18:23:23 +0100 Subject: [PATCH] Add jinja templates for blog --- src/blog/jinja2/blog/category.jinja2 | 5 +++++ src/blog/jinja2/blog/detail.jinja2 | 17 +++++++++++++++++ src/blog/jinja2/blog/index.jinja2 | 22 ++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 src/blog/jinja2/blog/category.jinja2 create mode 100644 src/blog/jinja2/blog/detail.jinja2 create mode 100644 src/blog/jinja2/blog/index.jinja2 diff --git a/src/blog/jinja2/blog/category.jinja2 b/src/blog/jinja2/blog/category.jinja2 new file mode 100644 index 00000000..7640507c --- /dev/null +++ b/src/blog/jinja2/blog/category.jinja2 @@ -0,0 +1,5 @@ +{% extends "blog/index.jinja2" %} + +{% block page_title %} +

{{ category }}

+{% endblock page_title %} \ No newline at end of file diff --git a/src/blog/jinja2/blog/detail.jinja2 b/src/blog/jinja2/blog/detail.jinja2 new file mode 100644 index 00000000..b1e05f42 --- /dev/null +++ b/src/blog/jinja2/blog/detail.jinja2 @@ -0,0 +1,17 @@ +{% extends '/core/home.jinja2' %} + + +{% block content %} + {% block page_title %} +

{{ post.title }}

+ {% endblock page_title %} + + {{ post.created }} | Categories: + {% for category in post.categories.all() %} + + {{ category.name }} + + {% endfor %} + +

{{ post.body }}

+{% endblock %} \ No newline at end of file diff --git a/src/blog/jinja2/blog/index.jinja2 b/src/blog/jinja2/blog/index.jinja2 new file mode 100644 index 00000000..17636d9a --- /dev/null +++ b/src/blog/jinja2/blog/index.jinja2 @@ -0,0 +1,22 @@ +{% extends '/core/home.jinja2' %} + + +{% block content %} + {% block page_title %} +

Blog Posts

+ {% endblock page_title %} + + {% for post in posts %} +

{{ post.title }}

+ + {{ post.created.date() }} | Categories: + {% for category in post.categories.all() %} + + {{ category.name }} + + {% endfor %} + +

{{ post.body[:PREVIEW_SIZE]}}...

+ {% endfor %} + +{% endblock %} \ No newline at end of file