From a8f73fb7a644d4d48f362563d4b5615b163e82c2 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 14 Aug 2026 10:41:47 -1000 Subject: Serve the plain listing as a complete document --- source/ui-plain.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source/ui-plain.c') diff --git a/source/ui-plain.c b/source/ui-plain.c index 9ce25b3..ed1ab31 100644 --- a/source/ui-plain.c +++ b/source/ui-plain.c @@ -127,9 +127,14 @@ static void print_dir(const struct object_id *oid, const char *base, leading_slash = (fullpath[0] == '/' ? "" : "/"); ctx.page.etag = oid_to_hex(oid); cgit_print_http_headers(); - htmlf("%s", leading_slash); + // The listing is a full document of its own, so it carries the same + // doctype and charset as the layout pages or the browser would parse + // it in quirks mode. + html("<!DOCTYPE html>\n<html lang='en'>\n<head>\n"); + html("<meta charset='utf-8'>\n"); + htmlf("<title>%s", leading_slash); html_txt(fullpath); - htmlf("\n\n

%s", leading_slash); + htmlf("\n\n\n

%s", leading_slash); html_txt(fullpath); html("

\n\n\n"); + html("\n\n\n"); } /* -- cgit v2.8.0