From: Lukas Pirl Date: Wed, 13 May 2020 08:57:48 +0000 (+0200) Subject: pelican-theme: wrap page/article content in blocks. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=a9853bfde89826a7ff9e1bb21401862bb5613532;p=blog.git pelican-theme: wrap page/article content in blocks. For easier extension/customization/overriding of templates. --- diff --git a/pelican-theme/templates/article.html b/pelican-theme/templates/article.html index 7b09f18b..611fe9c8 100644 --- a/pelican-theme/templates/article.html +++ b/pelican-theme/templates/article.html @@ -1,5 +1,11 @@ {% extends "base_blog.html" %} +{%- macro article_content_block() -%} + {% block article_content -%} + {{- article.content|trim -}} + {%- endblock %} +{%- endmacro -%} + {% block title %}{{ article.title }} | {{ M_BLOG_NAME|e }}{% endblock %} {% block head_links %} @@ -93,7 +99,7 @@ {{ M_ARCHIVED_ARTICLE_BADGE|render_rst|replace('{year}', article.date.year)|indent(8) }} {% endif %} -{{ article.content|trim }} +{{ article_content_block() }} {% if article.category.badge or (article.author and article.author.badge) %} {{ badges()|rtrim|indent(10) }} @@ -121,7 +127,7 @@ {% endif %} {% if article.content %} -{{ article.content|trim }} +{{ article_content_block() }} {% endif %} {% if article.category.badge or (article.author and article.author.badge) %} diff --git a/pelican-theme/templates/page.html b/pelican-theme/templates/page.html index 2328e101..a41182ac 100644 --- a/pelican-theme/templates/page.html +++ b/pelican-theme/templates/page.html @@ -117,7 +117,9 @@ {% endif %} {% if page.content %} -{{ page.content|trim }} +{% block page_content -%} + {{- page.content|trim }} +{% endblock %} {% endif %} diff --git a/pelican-theme/templates/passthrough.html b/pelican-theme/templates/passthrough.html index bdf92b77..7570ef95 100644 --- a/pelican-theme/templates/passthrough.html +++ b/pelican-theme/templates/passthrough.html @@ -21,6 +21,8 @@ {% endif %} -{{- page.content -}} +{%- block page_content -%} + {{- page.content -}} +{%- endblock -%}