From 8ede27f75eea9595768eef09ba744f12650e1412 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 1 Nov 2026 15:42:57 -1000 Subject: Lead an error page's title with the error The config error page had a title of its own, in the reverse order, and now takes the same one as any other 404, since its message already says the repository failed to open. --- source/ui-shared.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source/ui-shared.c') diff --git a/source/ui-shared.c b/source/ui-shared.c index 0865ffa..e346cbd 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -1457,8 +1457,8 @@ static void print_docstart(void) html("\n"); html("\n"); html(""); - // An error page reached before a title was chosen still has to name - // itself, since an empty title element is not valid. + // A page that chose no title still has to name itself, since an empty + // title element is not valid. html_txt(ctx.page.title ? ctx.page.title : ctx.cfg.root_title); // The auth page goes out before the repository is opened, when // pinned_oid cannot resolve anything yet. @@ -1542,6 +1542,12 @@ void cgit_print_error_page(int code, const char *msg, const char *fmt, ...) } ctx.page.status = code; ctx.page.statusmsg = msg; + // The error stands where a page would name itself, ahead of the + // repository and the site. + if (ctx.repo) + ctx.page.title = xstrfmt("%s - %s - %s", msg, ctx.repo->name, ctx.cfg.root_title); + else + ctx.page.title = xstrfmt("%s - %s", msg, ctx.cfg.root_title); // A page that had already chosen another type, such as an image // served through the about page, still answers its error as html. ctx.page.mimetype = "text/html"; -- cgit 2.12.1