summary refs log tree commit diff stats
path: root/src/themes/serene/templates/blog.html
blob: 2519d28027732ddd42c62613c3d3892bf249c701 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{% import "macros/prose.html" as macros %}
{% extends "_base.html" %}

{% block page %}blog{% endblock page%}
{% block lang %}{% if section.extra.lang %}{{ section.extra.lang }}{% else %}{{ section.lang }}{% endif %}{% endblock lang %}
{% block title %}{{ section.title }}{% endblock title %}
{% block desc %}
  {% if section.description %}
    {% set desc = section.description %}
  {% else %}
    {% set desc = config.description %}
  {% endif %}
  <meta name="description" content="{{ desc }}">
{% endblock desc %}

{% block content %}
<div id="wrapper">
  {{ macros::back_link(path = get_url(path="/")) }}
  {% include "_section_title.html" %}
  <main class="layout-list">
    {% if section.extra.categorized %}
    {% for category,posts in section.pages | sort(attribute="taxonomies.categories.0") | group_by(attribute="taxonomies.categories.0") %}
    {% set category_name = category %}
    {% if category is matching("^__[0-9]{2}__") %}
      {% set category_name = category | split(pat="") | slice(start=7) | join(sep="") %}
    {% endif %}
    <h2 class="category">{{ category_name }}</h2>
    <div class="post-list categorized">
      {% for post in posts %}
      <a class="post instant {% if post.extra.featured %}featured{% endif %}" href="{{ post.permalink | safe }}">
        <span>{{ post.title }}</span>
        <span class="date">{{ post.date | date(format=section.extra.date_format) }}</span>
      </a>
      {% endfor %}
    </div>
    {% endfor %}
    {% else %}
    <div class="post-list">
      {% for post in section.pages %}
      <a class="post instant {% if post.extra.featured %}featured{% endif %}" href="{{ post.permalink | safe }}">
        <span>{{ post.title }}</span>
        <span class="date">{{ post.date | date(format=section.extra.date_format) }}</span>
      </a>
      {% endfor %}
    </div>
    {% endif %}
  </main>
  {% include "_footer.html" %}
</div>
{% endblock content %}