blob: e2188cfc1f591993467ab039909ed8838a1c360f (
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
|
{% extends "templates/layout.html" %}
{% block content %}
<main class="main-container">
<a href="/blog" class="back-link-top">← back</a>
<header>
<h1>Elias Haugsbakk's Blog</h1>
<p class="intro-text">For search: "<strong>{{ search_term }}</strong>" -- Found {{ results_count }} matching posts</p>
<form action="/blog" method="GET" class="search-form">
<input type="text" name="search" value="{{ search_term }}" placeholder="Search posts..." aria-label="Search blog posts">
<button type="submit">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 blog posts. Or <a href="/blog">go back to all posts</a>.</p>
{% else %}
<p>Found no posts matching <strong>"{{ search_term }}"</strong>. <br>
<a href="/blog">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="search-result-date">{{ post.formattedDate }}</span>
<a href="/blog/{{ post.slug }}">{{ post.title }}</a>
{% if post.summary is not empty %}
<span class="search-result-summary">-- {{ post.summary }}</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</main>
{% endblock %}
|