From d56f51a2d3236e262a58b3c9cdaeebb30d4ee7a1 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Sun, 3 Jan 2021 15:03:49 +0100 Subject: [PATCH] Move macros Each edition now has their own macros, so create a macros.html for the third edition too. Since the utterances theme differs between editions, we need to move it from snippets.html to the edition-specific macros.html too. --- blog/templates/edition-2/extra.html | 4 +- blog/templates/edition-2/macros.html | 47 +++++--------------- blog/templates/edition-2/news-page.html | 25 +++++++++++ blog/templates/edition-2/page.html | 2 +- blog/templates/edition-3/extra.html | 4 +- blog/templates/edition-3/index.html | 7 +-- blog/templates/edition-3/macros.html | 58 +++++++++++++++++++++++++ blog/templates/edition-3/page.html | 7 +-- blog/templates/news-page.html | 26 +---------- blog/templates/snippets.html | 10 ----- 10 files changed, 107 insertions(+), 83 deletions(-) create mode 100644 blog/templates/edition-2/news-page.html create mode 100644 blog/templates/edition-3/macros.html diff --git a/blog/templates/edition-2/extra.html b/blog/templates/edition-2/extra.html index 93c98f59..c098e58c 100644 --- a/blog/templates/edition-2/extra.html +++ b/blog/templates/edition-2/extra.html @@ -1,6 +1,6 @@ {% extends "edition-2/base.html" %} -{% import "snippets.html" as snippets %} +{% import "edition-2/macros.html" as macros %} {% block title %}{{ page.title }} | {{ config.title }}{% endblock title %} @@ -17,6 +17,6 @@

Comments

- {{ snippets::utterances() }} + {{ macros::utterances() }}
{% endblock after_main %} diff --git a/blog/templates/edition-2/macros.html b/blog/templates/edition-2/macros.html index 1faf1bcd..77ffac7b 100644 --- a/blog/templates/edition-2/macros.html +++ b/blog/templates/edition-2/macros.html @@ -26,43 +26,6 @@ {% endmacro post_link %} -{% macro post_link_edition_3(page) %} -
- {% set translations = page.translations | filter(attribute="lang", value=lang) -%} - {%- if translations -%} - {%- set post = get_page(path = translations.0.path) -%} - {%- else -%} - {%- set post = page -%} - {%- set not_translated = true -%} - {%- endif -%} -

{{ post.title }}

- - {%- if post.extra.icon -%}{{post.extra.icon | safe}}{%- endif -%} - -
- {{ post.summary | safe }} - read more » - - {%- if lang and not_translated and lang != config.default_language -%} - - {%- endif -%} -
-
-{% endmacro post_link %} - - -{% macro utterances_edition_3() %} - -{% endmacro utterances_edition_3 %} {% macro toc(toc) %}
Table of Contents @@ -79,3 +42,13 @@
{% endmacro toc %} + +{% macro utterances() %} + +{% endmacro utterances %} diff --git a/blog/templates/edition-2/news-page.html b/blog/templates/edition-2/news-page.html new file mode 100644 index 00000000..bf6f59b2 --- /dev/null +++ b/blog/templates/edition-2/news-page.html @@ -0,0 +1,25 @@ +{% extends "edition-2/base.html" %} + +{% import "edition-2/macros.html" as macros %} + +{% block title %}{{ page.title }} | {{ config.title }}{% endblock title %} + +{% block main %} +

{{ page.title }}

+ + {{ page.content | safe }} +{% endblock main %} + +{% block after_main %} +
+
+

Comments

+ {{ macros::utterances() }} +
+ +{% endblock after_main %} + + diff --git a/blog/templates/edition-2/page.html b/blog/templates/edition-2/page.html index 13a70d79..7ccfa1f2 100644 --- a/blog/templates/edition-2/page.html +++ b/blog/templates/edition-2/page.html @@ -99,7 +99,7 @@

{% endif %} - {{ snippets::utterances() }} + {{ macros::utterances() }}