From 463c202d80f57efb8e46bab4ee4ad7038444b25d Mon Sep 17 00:00:00 2001 From: Elias Haugsbakk Date: Mon, 6 Jul 2026 21:12:40 +0200 Subject: implement post searching --- .../src/main/resources/templates/blog-search.html | 41 ++++++++++++++++++++++ .../src/main/resources/templates/blog.html | 25 ++++++++++--- .../src/main/resources/templates/layout.html | 5 +++ .../src/main/resources/templates/post.html | 1 + 4 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 clams-server/src/main/resources/templates/blog-search.html (limited to 'clams-server/src/main/resources/templates') diff --git a/clams-server/src/main/resources/templates/blog-search.html b/clams-server/src/main/resources/templates/blog-search.html new file mode 100644 index 0000000..e2188cf --- /dev/null +++ b/clams-server/src/main/resources/templates/blog-search.html @@ -0,0 +1,41 @@ +{% extends "templates/layout.html" %} + +{% block content %} +
+ ← back +
+

Elias Haugsbakk's Blog

+

For search: "{{ search_term }}" -- Found {{ results_count }} matching posts

+ +
+ + +
+
+ +
+ {% if results is empty %} +
+ {% if search_term is empty %} +

Please enter a search term to search the blog posts. Or go back to all posts.

+ {% else %} +

Found no posts matching "{{ search_term }}".
+ Go back to all posts.

+ {% endif %} +
+ {% else %} +
    + {% for post in results %} +
  • + {{ post.formattedDate }} + {{ post.title }} + {% if post.summary is not empty %} + -- {{ post.summary }} + {% endif %} +
  • + {% endfor %} +
+ {% endif %} +
+
+{% endblock %} diff --git a/clams-server/src/main/resources/templates/blog.html b/clams-server/src/main/resources/templates/blog.html index 200a144..2c484a1 100644 --- a/clams-server/src/main/resources/templates/blog.html +++ b/clams-server/src/main/resources/templates/blog.html @@ -4,10 +4,12 @@

Elias Haugsbakk's Blog

-

This is the home page for my blog. The list of blog posts is a diverse collection of some of my writings; if you're just browsing, this might be a good place to start.

+

This is the home page for my blog. The featured list is a diverse collection of some + of my writings; if you're just browsing, this might be a good place to start.

- +
@@ -16,14 +18,29 @@

All Posts

- {{ all_posts| raw }} + {% for group in posts_by_year %} +
+ {{ group.key }} + +
+ {% endfor %}

Featured

- {{ recent_posts | raw }} +
    + {% for post in featured_posts %} +
  • + {{ post.title }} -- {{ post.summary }} +
  • + {% endfor %} +
diff --git a/clams-server/src/main/resources/templates/layout.html b/clams-server/src/main/resources/templates/layout.html index 4c8b8dc..1460721 100644 --- a/clams-server/src/main/resources/templates/layout.html +++ b/clams-server/src/main/resources/templates/layout.html @@ -6,6 +6,11 @@ {{ page_title }} + + + + + diff --git a/clams-server/src/main/resources/templates/post.html b/clams-server/src/main/resources/templates/post.html index 7e99e1f..7899099 100644 --- a/clams-server/src/main/resources/templates/post.html +++ b/clams-server/src/main/resources/templates/post.html @@ -2,6 +2,7 @@ {% block content %}
+ ← back
-- cgit v1.2.3