From f1975896c705a91f8848f28ceb88211e70a724d4 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 13 Aug 2026 20:09:18 -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') 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 2.12.1