forked from nestordedios/bolt-theme-editorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.twig
68 lines (51 loc) · 2.37 KB
/
search.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
{% extends 'partials/_master.twig' %}
{% block main %}
{# This template is used for search results. If 'search' is defined,
we display an appropriate title. The 'records' array contains all of the
records matching the current query. If there are no results, the
code in the 'else' part of the for-loop is used. #}
<section id="search" class="alt">
<h1>
{% if search is not empty %}
{{ __('general.phrase.search-results-for-variable', { '%search%': search }) }}
{% else %}
{{ __('general.phrase.search') }}
{% endif %}
</h1>
{# Perhaps we post a small teaser, stored in the 'block' named 'Search teaser' #}
{% setcontent block = "block/search-teaser" %}
{# check if we have 'content'. If so, we know we have have a teaser to display. #}
{% if block.content is defined %}
{{ block.content }}
{% endif %}
</section>
{% for record in records %}
<article>
<h2><a href="{{ record.link }}">{{ record.title }}</a></h2>
<span class="image main"><img src="{{ record.image|thumbnail(1417, 461) }}" alt="" /></span>
{# 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 } %}
<ul class="actions">
<li><a href="{{ record.link }}" class="button big">Read More</a></li>
</ul>
</article>
{% if not loop.last %}
<hr>
{% endif %}
{% else %}
<article>
<p>
{{ __('general.phrase.no-result-for-search-term', { '%SEARCHTERM%': search|escape }) }}
</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 %}