commit 430afe1

default  ·  2024-05-09 20:57:08 +0000 UTC
parent a5766a6
Added a title to search results.
1 files changed,  +7, -1
M html.c
M html.c
+7, -1
 1@@ -2566,8 +2566,14 @@ int html_get_handler(const xs_dict *req, const char *q_path,
 2                 /* search by content */
 3                 int to = 0;
 4                 xs *tl = content_search(&snac, q, 1, 0, show, &to);
 5+                xs *title = NULL;
 6 
 7-                *body   = html_timeline(&snac, tl, 0, 0, show, 0, NULL, "/admin", 1);
 8+                if (xs_list_len(tl))
 9+                    title = xs_fmt(L("Search results for '%s'"), q);
10+                else
11+                    title = xs_fmt(L("Nothing found for '%s'"), q);
12+
13+                *body   = html_timeline(&snac, tl, 0, 0, show, 0, title, "/admin", 1);
14                 *b_size = strlen(*body);
15                 status  = 200;
16             }