-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfolder.twig
73 lines (48 loc) · 1.61 KB
/
folder.twig
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{% include 'partials/breadcrumb.twig' %}
<article class="font-lead lh-lead fw4 fw1-l">
<header>
<h1>{{ title }}</h1>
</header>
{{ content }}
</article>
<section class="font-copy lh-copy">
{% if item.contains == 'pages' %}
<ol class="list pa0" reversed>
{% for element in item.folderContent %}
{% set page = getPageMeta(settings, element) %}
<li class="mt5-l">
<a href="{{ element.urlAbs }}"><h2>{{ page.meta.title }}</h2></a>
<p>{{ page.meta.description }}</p>
</li>
{% endfor %}
</ol>
{% elseif item.contains == 'posts' %}
{% set pagesize = 10 %}
{% set pages = ( item.folderContent|length / pagesize)|round(0, 'ceil') %}
{% set currentpage = currentpage ? currentpage : 1 %}
{% set currentposts = (currentpage - 1) * pagesize %}
<ol class="list pa0" reversed>
{% for element in item.folderContent|slice(currentposts, pagesize) %}
{% set post = getPageMeta(settings, element) %}
{% set date = element.order[0:4] ~ '-' ~ element.order[4:2] ~ '-' ~ element.order[6:2] %}
<li class="mt5-l">
<a href="{{ element.urlAbs }}"><h2>{{ post.meta.title }}</h2></a>
<small><time datetime="{{date}}">{{ date | date("d.m.Y") }}</time> | {{ post.meta.author }}</small>
<p>{{ post.meta.description }}</p>
</li>
{% endfor %}
{% if pages > 1 %}
<hr class="mv4">
<p>Page:
{% for i in 1 .. pages %}
{% if i == currentpage %}
{{i}}
{% else %}
<a class="page" href="{{ item.urlAbs }}/p/{{i}}">{{i}}</a>
{% endif %}
{% endfor %}
</p>
{% endif %}
</ol>
{% endif %}
</section>