This repository has been archived by the owner on Dec 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.twig
64 lines (48 loc) · 2.29 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
{% 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. #}
<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 %}
<form method="get" action="{{ paths.root }}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>
{% for record in records %}
<article>
<h2><a href="{{ record.link }}">{{ record.title }}</a></h2>
{% if record.image!="" %}
<div class="large-4 imageholder">
<a href="{{ image(record.image) }}">
<img src="{{ thumbnail(record.image, 400, 260) }}">
</a>
</div>
{% endif %}
{# display something introduction-like.. #}
<p>{{ record.excerpt(300, false, search|default('')) }}</p>
</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. #}
{% endblock main %}