Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
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.
Diffstat (limited to 'source/ui-shared.c')
| -rw-r--r-- | source/ui-shared.c | 10 |
1 file changed, 8 insertions, 2 deletions
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("<meta name='theme-color' media='(prefers-color-scheme: light)' content='#ffffff'>\n"); html("<meta name='theme-color' media='(prefers-color-scheme: dark)' content='#1b1b1b'>\n"); html("<title>"); - // 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"; |
