From fed534ba9163363c52a6453f5dfaeb0eab8e7c01 Mon Sep 17 00:00:00 2001
From: Konstantin Kostov
Date: Fri, 1 Mar 2024 19:46:46 +0100
Subject: [PATCH] adds search
---
.../templates/includes/header.html | 1 +
search/templates/search/search.html | 17 ++++++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/iamkonstantin_web/templates/includes/header.html b/iamkonstantin_web/templates/includes/header.html
index 8eeb78a..25e912d 100644
--- a/iamkonstantin_web/templates/includes/header.html
+++ b/iamkonstantin_web/templates/includes/header.html
@@ -10,6 +10,7 @@
{% for menuitem in site_root.get_children.live.in_menu %}
{{ menuitem.title }}{% if not forloop.last %} | {% endif %}
{% endfor %}
+ | Search
{% wagtailuserbar "top-right" %}
diff --git a/search/templates/search/search.html b/search/templates/search/search.html
index 476427f..8fd268f 100644
--- a/search/templates/search/search.html
+++ b/search/templates/search/search.html
@@ -14,7 +14,12 @@
{% if search_results %}
-
+
+{# Add this paragraph to display the details of results found: #}
+You searched{% if search_query %} for “{{ search_query }}”{% endif %}, {{ search_results.paginator.count }} result{{ search_results.paginator.count|pluralize }} found.
+
+{# Replace the HTML element with the html element: #}
+
{% for result in search_results %}
-
@@ -23,7 +28,12 @@
{% endif %}
{% endfor %}
-
+
+
+{# Improve pagination by adding: #}
+{% if search_results.paginator.num_pages > 1 %}
+ Page {{ search_results.number }} of {{ search_results.paginator.num_pages }}, showing {{ search_results|length }} result{{ search_results|pluralize }} out of {{ search_results.paginator.count }}
+{% endif %}
{% if search_results.has_previous %}
Previous
@@ -32,7 +42,8 @@
{% if search_results.has_next %}
Next
{% endif %}
+
{% elif search_query %}
No results found
{% endif %}
-{% endblock %}
+{% endblock %}
\ No newline at end of file