From 3405e5f3e7bc0712bdae3f2b4fcff0b67c371ad0 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 1 Nov 2026 19:25:02 -1000 Subject: Keep the login page out of search indexes --- source/ui-shared.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/ui-shared.c b/source/ui-shared.c index 5e4aec2..cb5e050 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -1446,7 +1446,7 @@ static void print_docstart(void) { const struct object_id *pinned; struct string_list_item *item; - const char *desc; + const char *desc, *robots; char *host; if (ctx.cfg.embedded) { @@ -1485,9 +1485,12 @@ static void print_docstart(void) htmlf("\n", cgit_version); else html("\n"); - if (ctx.cfg.robots && *ctx.cfg.robots) { + // The login page answers in place of the page asked for, so it must + // not be indexed as that page. + robots = ctx.env.authenticated ? ctx.cfg.robots : "noindex, nofollow"; + if (robots && *robots) { html("\n"); } -- cgit 2.12.1