diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2020-06-05 11:25:07 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2020-06-05 11:25:07 +0200 |
commit | 9386fe8c132944d001884630ed4e931e37c828c4 (patch) | |
tree | 9d9b313c162817d7d2a25879e08ef7c1dbd9fcd7 | |
parent | b6448fc9060e63ca4f2cb08a8f679c89ad2bdfa1 (diff) | |
download | rabalderz-9386fe8c132944d001884630ed4e931e37c828c4.tar.gz rabalderz-9386fe8c132944d001884630ed4e931e37c828c4.tar.bz2 rabalderz-9386fe8c132944d001884630ed4e931e37c828c4.zip |
Add section template.
Also move most content to the section templates, leave only section
descriptions and the latest posts in each for the index page.
-rw-r--r-- | templates/index.html | 78 | ||||
-rw-r--r-- | templates/section.html | 44 |
2 files changed, 74 insertions, 48 deletions
diff --git a/templates/index.html b/templates/index.html index a712ac4..08beb0a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,53 +1,35 @@ {% extends "base.html" %} {% block content %} -<div class="home"> - <section id="home-blurb"> - {{ section.content | safe }} - </section> +<section id="home-blurb"> + {{ section.content | safe }} +</section> - <ul class="subsections"> - {% for sub in section.subsections %} - {% set s = get_section(path=sub) %} - <li><a href="{{s.permalink | safe}}">{{ s.title }}</a></li> - <ul class="post-list"> - {% for post in s.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> - <section class="post-summary"> - {% if post.summary %} - {{ post.summary | safe }} - {% else %} - {{ post.content | safe }} - {% endif %} - </section> - <footer> - {% if post.summary %} - <a href="{{ post.permalink }}"> - {{ trans(key="moreprompt", lang=post.lang) }} - </a> - {% endif %} - </footer> - </article> - {% endfor %} - </ul> - {% endfor %} - </ul> -</div> +<section class="subsections"> + {% for sub in section.subsections %} + {% set s = get_section(path=sub) %} + <article> + <header> + <h1><a href="{{s.permalink | safe}}">{{ s.title }}</a></h1> + <div class="description"> + {{ s.description | markdown | safe }} + </div> + </header> + <section class="post-list"> + <h2>Siste innlegg:</h2> + <ul> + {% for post in s.pages | reverse %} + <li> + {{ post.date }}: + <a href="{{ post.permalink | safe }}"> + {{ post.title }} + </a> + </li> + {% if loop.index == 5 %}{% break %}{% endif %} + {% endfor %} + </ul> + </section> + </article> + {% endfor %} +</section> {% endblock content %} diff --git a/templates/section.html b/templates/section.html new file mode 100644 index 0000000..b65fdf1 --- /dev/null +++ b/templates/section.html @@ -0,0 +1,44 @@ +{% extends "base.html" %} +{% block content %} +<h1>{{ section.title }}</h1> + +{{ section.description }} + +<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> + <section class="post-summary"> + {% if post.summary %} + {{ post.summary | safe }} + {% else %} + {{ post.content | safe }} + {% endif %} + </section> + <footer> + {% if post.summary %} + <a href="{{ post.permalink }}"> + {{ trans(key="moreprompt", lang=post.lang) }} + </a> + {% endif %} + </footer> + </article> + {% endfor %} +</section> +{% endblock content %} |