From 0e91926ff40b3df1914375165633bb703c176558 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Sat, 5 Jun 2021 01:21:59 -0600 Subject: simplify templates --- blog/plt/base.html | 14 ++------------ blog/plt/index.html | 27 +++++++-------------------- blog/plt/page.html | 11 ++++------- blog/plt/page_list.html | 15 +++++++++++++++ blog/plt/tag.html | 18 +++++------------- blog/plt/tag_list.html | 9 +++++++++ 6 files changed, 42 insertions(+), 52 deletions(-) create mode 100644 blog/plt/page_list.html create mode 100644 blog/plt/tag_list.html (limited to 'blog/plt') diff --git a/blog/plt/base.html b/blog/plt/base.html index 9919829..3350593 100644 --- a/blog/plt/base.html +++ b/blog/plt/base.html @@ -1,20 +1,10 @@ -{%if page is defined%} - -{%else%} - -{%endif%} + - {%if page is defined%} - {{page.title}} -- {{site_title}} - {%elif tag is defined%} - Posts filtered by {{tag[0]}} -- {{site_title}} - {%else%} - Index -- {{site_title}} - {%endif%} + {%block head_title%}{%endblock head_title%} -- {{site_title}} diff --git a/blog/plt/index.html b/blog/plt/index.html index 7efcf20..189c7fe 100644 --- a/blog/plt/index.html +++ b/blog/plt/index.html @@ -1,4 +1,6 @@ {%extends "base.html"%} +{%block html_lang%}en{%endblock html_lang%} +{%block head_title%}Index{%endblock head_title%} {%block content%}

Index -- {{site_title}}

@@ -10,25 +12,10 @@ Get the RSS feed: {{site_base_url}}/rss.xml

-
-

Tags: - {%for t in all_tags%} - {{t[0]}}{{", " if not loop.last else ""}} - {%endfor%} -

-
+ {%import "tag_list.html" as tag_list%} + {{tag_list.print(all_tags)}} + + {%import "page_list.html" as page_list%} + {{page_list.print(all_pages)}} -

Articles

- {%endblock content%} diff --git a/blog/plt/page.html b/blog/plt/page.html index a98338e..6128d3b 100644 --- a/blog/plt/page.html +++ b/blog/plt/page.html @@ -1,4 +1,6 @@ {%extends "base.html"%} +{%block html_lang%}{{page.lang}}{%endblock html_lang%} +{%block head_title%}{{page.title}}{%endblock head_title%} {%block content%}

{{page.title}}

@@ -11,12 +13,7 @@ {%if page.mdate is not none%}

Modified: {{page.mdate}}

{%endif%} -
-

Tags: - {%for t in page.tags%} - {{t[0]}}{{", " if not loop.last else ""}} - {%endfor%} -

-
+ {%import "tag_list.html" as tag_list%} + {{tag_list.print(page.tags)}} {%endblock content%} diff --git a/blog/plt/page_list.html b/blog/plt/page_list.html new file mode 100644 index 0000000..16dc4d5 --- /dev/null +++ b/blog/plt/page_list.html @@ -0,0 +1,15 @@ +{%macro print(pages)%} +

Articles

+ +{%endmacro%} diff --git a/blog/plt/tag.html b/blog/plt/tag.html index 50b221f..2203f33 100644 --- a/blog/plt/tag.html +++ b/blog/plt/tag.html @@ -1,18 +1,10 @@ {%extends "base.html"%} +{%block html_lang%}en{%endblock html_lang%} +{%block head_title%}Posts filtered by {{tag[0]}}{%endblock head_title%} {%block content%}

Posts filtered by {{tag[0]}}

-

Articles

- + {%import "page_list.html" as page_list%} + {{page_list.print(tag_pages)}} + {%endblock content%} diff --git a/blog/plt/tag_list.html b/blog/plt/tag_list.html new file mode 100644 index 0000000..2dfb70c --- /dev/null +++ b/blog/plt/tag_list.html @@ -0,0 +1,9 @@ +{%macro print(tags)%} +
+

Tags: + {%for t in tags-%} + {{t[0]}}{{", " if not loop.last else ""}} + {%-endfor%} +

+
+{%endmacro%} -- cgit v1.2.3-70-g09d2