summaryrefslogtreecommitdiff
path: root/blog/plt
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2021-06-05 01:21:59 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2021-06-05 01:21:59 -0600
commit0e91926ff40b3df1914375165633bb703c176558 (patch)
treee324842456b2651f5bf384f9c91222de975c3f03 /blog/plt
parentb171347f739b2ada7960ad50bcba47e898d890d2 (diff)
simplify templates
Diffstat (limited to 'blog/plt')
-rw-r--r--blog/plt/base.html14
-rw-r--r--blog/plt/index.html27
-rw-r--r--blog/plt/page.html11
-rw-r--r--blog/plt/page_list.html15
-rw-r--r--blog/plt/tag.html18
-rw-r--r--blog/plt/tag_list.html9
6 files changed, 42 insertions, 52 deletions
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 @@
<!DOCTYPE html>
-{%if page is defined%}
-<html lang="{{page.lang}}">
-{%else%}
-<html lang="en">
-{%endif%}
+<html lang="{%block html_lang%}{%endblock html_lang%}">
<head>
<base href="{{site_base_static_url}}">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
- {%if page is defined%}
- <title>{{page.title}} -- {{site_title}}</title>
- {%elif tag is defined%}
- <title>Posts filtered by {{tag[0]}} -- {{site_title}}</title>
- {%else%}
- <title>Index -- {{site_title}}</title>
- {%endif%}
+ <title>{%block head_title%}{%endblock head_title%} -- {{site_title}}</title>
<link rel="alternate" type="application/rss+xml" href="{{site_base_url}}/rss.xml" title="{{site_title}} RSS">
<link rel="icon" href="images/icons/favicon.ico">
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%}
<h1>Index -- {{site_title}}</h1>
@@ -10,25 +12,10 @@
Get the RSS feed: <a target="_blank" href="{{site_base_url}}/rss.xml">{{site_base_url}}/rss.xml</a>
</p>
- <div class="article-tags">
- <p>Tags:
- {%for t in all_tags%}
- <a href="{{t[1]}}">{{t[0]}}</a>{{", " if not loop.last else ""}}
- {%endfor%}
- </p>
- </div>
+ {%import "tag_list.html" as tag_list%}
+ {{tag_list.print(all_tags)}}
+
+ {%import "page_list.html" as page_list%}
+ {{page_list.print(all_pages)}}
- <h2>Articles</h2>
- <ul>
- {%for p in all_pages%}
- {%if loop.previtem%}
- {%if loop.previtem.cdate_list_sep !=p.cdate_list_sep%}
- <h3>{{p.cdate_list_sep}}</h3>
- {%endif%}
- {%else%}
- <h3>{{p.cdate_list_sep}}</h3>
- {%endif%}
- <li>{{p.cdate_list}} - <a href="{{p.url}}">{{p.title}}</a></li>
- {%endfor%}
- </ul>
{%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%}
<h1>{{page.title}}</h1>
@@ -11,12 +13,7 @@
{%if page.mdate is not none%}
<p>Modified: {{page.mdate}}</p>
{%endif%}
- <div class="article-tags">
- <p>Tags:
- {%for t in page.tags%}
- <a href="{{t[1]}}">{{t[0]}}</a>{{", " if not loop.last else ""}}
- {%endfor%}
- </p>
- </div>
+ {%import "tag_list.html" as tag_list%}
+ {{tag_list.print(page.tags)}}
</div>
{%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)%}
+ <h2>Articles</h2>
+ <ul>
+ {%for p in pages%}
+ {%if loop.previtem%}
+ {%if loop.previtem.cdate_list_sep !=p.cdate_list_sep%}
+ <h3>{{p.cdate_list_sep}}</h3>
+ {%endif%}
+ {%else%}
+ <h3>{{p.cdate_list_sep}}</h3>
+ {%endif%}
+ <li>{{p.cdate_list}} - <a href="{{p.url}}">{{p.title}}</a></li>
+ {%endfor%}
+ </ul>
+{%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%}
<h1>Posts filtered by {{tag[0]}}</h1>
- <h2>Articles</h2>
- <ul>
- {%for p in tag_pages%}
- {%if loop.previtem%}
- {%if loop.previtem.cdate_list_sep !=p.cdate_list_sep%}
- <h3>{{p.cdate_list_sep}}</h3>
- {%endif%}
- {%else%}
- <h3>{{p.cdate_list_sep}}</h3>
- {%endif%}
- <li>{{p.cdate_list}} - <a href="{{p.url}}">{{p.title}}</a></li>
- {%endfor%}
- </ul>
+ {%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)%}
+<div class="article-tags">
+ <p>Tags:
+ {%for t in tags-%}
+ <a href="{{t[1]}}">{{t[0]}}</a>{{", " if not loop.last else ""}}
+ {%-endfor%}
+ </p>
+</div>
+{%endmacro%}