blob: 34a2ed50d0ca12d8c339daf31dac87c71e617e72 (
plain)
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
|
{% extends "templates/layout.html" %}
{% block content %}
<main class="main-container">
<a href="/posts" class="back-link-top">← back</a>
<header>
<h1>My posts</h1>
<p class="intro-text">For search: "<strong>{{ search_term }}</strong>" -- Found {{ results_count }} matching posts</p>
<form action="/posts" method="GET" class="search-form">
<input type="text" name="search" value="{{ search_term }}" placeholder="Search posts..." aria-label="Search posts">
<button type="submit" class="pill-button">Search</button>
</form>
</header>
<div class="search-results-container">
{% if results is empty %}
<div class="no-results">
{% if search_term is empty %}
<p>Please enter a search term to search the posts. Or <a href="/posts">go back to all posts</a>.</p>
{% else %}
<p>Found no posts matching <strong>"{{ search_term }}"</strong>. <br>
<a href="/posts">Go back to all posts</a>.</p>
{% endif %}
</div>
{% else %}
<ul class="search-results-list">
{% for post in results %}
<li class="search-result-item">
<span class="post-date">{{ post.formattedDate }}</span>
<a href="/posts/{{ post.slug }}">{{ post.title }}</a>
{% if post.summary is not empty %}
<br>
<span class="search-result-summary">-- {{ post.summary }}</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</main>
{% endblock %}
|