-
Notifications
You must be signed in to change notification settings - Fork 0
/
listing.twig
87 lines (76 loc) · 3.27 KB
/
listing.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{% extends 'partials/_master.twig' %}
{% block content %}
{# 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>
<hr>
{# 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 %}
{# if used for searches #}
{% if search is defined %}
<form method="get" action="{{ path('search') }}" id="searchform-inline" enctype="text/plain">
<input type="search" value="{{ search|default() }}" placeholder="{{ __('general.phrase.search-ellipsis') }}" name="search">
<button type="submit" class="button">{{ __('general.phrase.search') }}
</button>
</form>
<hr>
{% endif %}
{# BEGIN normal listing stuff #}
{% for record in records %}
{% if not record.contenttype.hide_in_listings %}
{# dont show anything if the contenttype has defined hide_in_listings = true #}
<div class="post">
<h1 class="post-title">
<a href="{{ record.link }}">
{{ record.title }}
</a>
</h1>
{% block recordinfos %}
<span class="post-date">
{% include('partials/_recordinfos.twig') %}
</span>
{% endblock recordinfos %}
<p class="post-teaser">
<a href="{{ record.link }}" class="readmore">
{% if record.image %}
<img src="{{ thumbnail(record.image, 'wide_500w') }}"
srcset="{{ thumbnail(record.image, 'wide_500w') }} 500w,
{{ thumbnail(record.image, 'wide_720w') }} 720w">
{% elseif record.introduction %}
{{ record.introduction }}
{% elseif record.teaser and record.teaser != "" %}
{{ record.teaser }}
{% else %}
<span>
{{ (record.body ~ record.content)|excerpt(250, false, search|default('')) }}
</span>
{% endif %}
</a>
</p>
</div>
{% endif %}
{% else %}
<div class="post">
<h1 class="post-title">
{{ __('general.phrase.no-content-found') }}
</h1>
<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>
</div>
{% endfor %}
{# If there are more records than will fit on one page, the pager is shown. #}
{{ pager(template = 'partials/_pager.twig') }}
{% endblock content %}