-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlisting.twig
More file actions
72 lines (56 loc) · 2.69 KB
/
listing.twig
File metadata and controls
72 lines (56 loc) · 2.69 KB
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
{% extends 'partials/_master.twig' %}
{% block main %}
{# This template is used for 'listings': Generic pages that list a number of
records from a certain contenttype. These records are available as an array
called 'records'. In the for-loop below, we iterate over the records that
are on this page. It can be used for overview pages like 'all entries', or
'all records tagged with kittens'. #}
{# If used for listing a taxonomy, we add a heading.: #}
{% if taxonomytype is defined %}
<h1>
{{ __('general.phrase.overview-for') }}
{% if taxonomy.options[slug] is defined %}
{{ taxonomy.options[slug] }}
{% else %}
{{ slug }}
{% endif %}
</h1>
{# Taxonomies are fetched unordered by design except if 'has_sortorder'
is set to true. This way we keep 'grouping' intact in the listing. #}
{% if not taxonomy.has_sortorder %}
{# If we specified an order in config.yml, sort them here, accordingly: #}
{% set records = records|order(config.get('general/listing_sort')) %}
{% endif %}
{% endif %}
{% for record in records %}
<article>
<h2><a href="{{ record.link }}">{{ record.title }}</a></h2>
{% if record.image!="" %}
<a href="{{ image(record.image) }}">
<img src="{{ thumbnail(record.image, 400, 260) }}">
</a>
{% endif %}
{# display something introduction-like.. #}
{% if record.introduction %}
{{ record.introduction }}
{% elseif record.teaser %}
{{ record.teaser }}
{% else %}
<p>{{ record.excerpt(300, false, search|default('')) }}</p>
{% endif %}
{% include 'partials/_recordfooter.twig' with { 'record': record } %}
</article>
{% if not loop.last %}
<hr>
{% endif %}
{% else %}
<article>
<h2>{{ __('general.phrase.no-content-found') }}</h2>
<p>
{{ __("Unfortunately, no content could be found. Try another page, or go to the <a href=\"%paths_root%\">homepage</a>.", {'%paths_root%': path('homepage')} ) }}
</p>
</article>
{% endfor %}
{# If there are more records than will fit on one page, the pager is shown. #}
{{ pager(template = 'partials/_sub_pager.twig') }}
{% endblock main %}