diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2020-06-06 17:26:51 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2020-06-06 17:26:51 +0200 |
commit | 1383fee0f3ee632110259218a20fbf5446814fd2 (patch) | |
tree | 3482a1618cbbe74f4a068591b4a9722b5ed1d956 /templates | |
parent | 6ba2af3d6b477e775dfbeaf8ed0f03d9d7648e32 (diff) | |
download | rabalderz-1383fee0f3ee632110259218a20fbf5446814fd2.tar.gz rabalderz-1383fee0f3ee632110259218a20fbf5446814fd2.tar.bz2 rabalderz-1383fee0f3ee632110259218a20fbf5446814fd2.zip |
Refactor post headers to separate template.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/page.html | 18 | ||||
-rw-r--r-- | templates/posts/header.html | 21 | ||||
-rw-r--r-- | templates/section.html | 18 |
3 files changed, 27 insertions, 30 deletions
diff --git a/templates/page.html b/templates/page.html index 5cdf946..49f3cd5 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,18 +1,10 @@ {% extends "base.html" %} {% block content %} +{% set post = page -%} <article class="post"> - <h1>{{ page.title }}</h1> - <div class="meta"> - <span class="meta-publish"> - Publisert: {{ page.date }} - {% if page.author %}av {{ page.author }}{% endif %} - </span> - {% if page.taxonomies %} - <span class="meta-tags"> - Merket: {{ page.taxonomies['tags'] | join(sep=", ") }} - </span> - {% endif %} - </div> - {{ page.content | safe }} + {% include "posts/header.html" %} + <section class="post-body"> + {{ post.content | safe }} + </section> </article> {% endblock content %} diff --git a/templates/posts/header.html b/templates/posts/header.html new file mode 100644 index 0000000..0266f6e --- /dev/null +++ b/templates/posts/header.html @@ -0,0 +1,21 @@ +<header> + <h1 class="post-title">{{ post.title }}</h1> + <div class="post-meta"> + <span class="meta-publish"> + Publisert: {{ post.date }} + {% if post.extra.author %}av {{ post.extra.author }}{% endif %} + </span> + {% if post.taxonomies %} + <div class="meta-tags"> + Merket: + {% for tag in post.taxonomies['tags'] -%} + <span> + <a class="tag-link" href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}"> + {{ tag }} + </a> + </span> + {% endfor -%} + </div> + {% endif %} + </div> +</header> diff --git a/templates/section.html b/templates/section.html index b65fdf1..fed7472 100644 --- a/templates/section.html +++ b/templates/section.html @@ -7,23 +7,7 @@ <section class="post-list"> {% for post in section.pages | reverse %} <article class="post"> - <header class="post-header"> - <div class="post-meta"> - {{ post.date }} - {% if post.taxonomies["tags"] | length > 0 %} - <ul class="post-tags"> - {% for tag in post.taxonomies["tags"] %} - <li class="tag">{{ tag }}</li> - {% endfor %} - </ul> - {% endif %} - </div> - <h1 class="post-title"> - <a href="{{ post.permalink | safe }}"> - {{ post.title }} - </a> - </h1> - </header> + {% include "posts/header.html" %} <section class="post-summary"> {% if post.summary %} {{ post.summary | safe }} |