From d92e1fb705b1b718610e3de36083584859eb9af8 Mon Sep 17 00:00:00 2001
From: Vincent Prouillet
Date: Thu, 16 Nov 2017 19:03:32 +0100
Subject: [PATCH] Add taxonomies
---
templates/categories.html | 19 +++++++++++++++++
templates/category.html | 14 +++++++++++++
templates/index.html | 43 ++++++++++++++------------------------
templates/page.html | 18 ++++++++++++++++
templates/post_macros.html | 17 +++++++++++++++
templates/tag.html | 13 ++++++++++++
templates/tags.html | 17 +++++++++++++++
7 files changed, 114 insertions(+), 27 deletions(-)
create mode 100644 templates/categories.html
create mode 100644 templates/category.html
create mode 100644 templates/tag.html
create mode 100644 templates/tags.html
diff --git a/templates/categories.html b/templates/categories.html
new file mode 100644
index 0000000..720aad4
--- /dev/null
+++ b/templates/categories.html
@@ -0,0 +1,19 @@
+{% extends "index.html" %}
+
+{% block content %}
+ {% block header %}
+ {{ super() }}
+ {% endblock header %}
+
+ Categories
+
+ {% if categories %}
+
+ {% for category in categories %}
+ -
+ {{ category.name }}({{ category.pages | length }})
+
+ {% endfor %}
+
+ {% endif %}
+{% endblock content %}
diff --git a/templates/category.html b/templates/category.html
new file mode 100644
index 0000000..208e662
--- /dev/null
+++ b/templates/category.html
@@ -0,0 +1,14 @@
+{% extends "index.html" %}
+{% import "post_macros.html" as post_macros %}
+
+{% block content %}
+ {% block header %}
+ {{ super() }}
+ {% endblock header %}
+
+ {{ category.name }}
+
+ {% for page in category.pages %}
+ {{ post_macros::page_in_list(page=page) }}
+ {% endfor %}
+{% endblock content %}
diff --git a/templates/index.html b/templates/index.html
index 392073d..6ff4604 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -25,19 +25,21 @@
{% block content %}
- {% if config.extra.after_dark_menu %}
-
- {% endif %}
+ {% block header %}
+ {% if config.extra.after_dark_menu %}
+
+ {% endif %}
+ {% endblock header %}
{% if config.extra.after_dark_title %}
@@ -46,20 +48,7 @@
{% endif %}
{% for page in paginator.pages %}
-
-
-
- {{ post_macros::meta(page=page) }}
-
- {% if page.summary %}
-
- {% endif %}
-
+ {{ post_macros::page_in_list(page=page) }}
{% endfor %}
{% endblock page_footer %}
diff --git a/templates/post_macros.html b/templates/post_macros.html
index 2e34188..e5b42bf 100644
--- a/templates/post_macros.html
+++ b/templates/post_macros.html
@@ -14,3 +14,20 @@
Published: {{ page.date | date(format="%F") }}
{% endmacro meta %}
+
+{% macro page_in_list(page) %}
+
+
+
+ {{ self::meta(page=page) }}
+
+ {% if page.summary %}
+
+ {% endif %}
+
+{% endmacro page_in_list %}
diff --git a/templates/tag.html b/templates/tag.html
new file mode 100644
index 0000000..4cb4c96
--- /dev/null
+++ b/templates/tag.html
@@ -0,0 +1,13 @@
+{% extends "index.html" %}
+
+{% block content %}
+ {% block header %}
+ {{ super() }}
+ {% endblock header %}
+
+ {{ tag.name }}
+
+ {% for page in tag.pages %}
+ {{ post_macros::page_in_list(page=page) }}
+ {% endfor %}
+{% endblock content %}
diff --git a/templates/tags.html b/templates/tags.html
new file mode 100644
index 0000000..395a3b7
--- /dev/null
+++ b/templates/tags.html
@@ -0,0 +1,17 @@
+{% extends "index.html" %}
+
+{% block content %}
+ {% block header %}
+ {{ super() }}
+ {% endblock header %}
+
+ Tags
+
+ {% if tags %}
+
+ {% for tag in tags %}
+ - {{ tag.name }} ({{ tag.pages | length }})
+ {% endfor %}
+
+ {% endif %}
+{% endblock content %}