From 07a8790205aadc9e301310514f3819e4e904b44f Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 27 Aug 2026 06:07:37 -1000 Subject: Add a meta description to the page head --- source/ui-shared.c | 12 ++++++++++++ tests/t0102-summary.sh | 3 +++ 2 files changed, 15 insertions(+) diff --git a/source/ui-shared.c b/source/ui-shared.c index e8eaf4f..cd822a0 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -1454,6 +1454,18 @@ void cgit_print_docstart(void) if (ctx.env.authenticated && (pinned = pinned_oid())) html_txtf(" @ %.*s", SHORT_HASH_LEN, oid_to_hex(pinned)); html("\n"); + // The placeholder a scanned repository carries instead of a description + // is left out, since it describes nothing. + if (ctx.repo && ctx.repo->desc && *ctx.repo->desc && + ctx.repo->desc != cgit_default_repo_desc) { + html("\n"); + } else if (!ctx.repo && ctx.cfg.root_desc && *ctx.cfg.root_desc) { + html("\n"); + } htmlf("\n", cgit_version); if (ctx.cfg.robots && *ctx.cfg.robots) { html("tmp' +test_expect_success 'repo description reaches the meta tag' ' + grep "" tmp +' test_expect_success 'no commit 45' '! grep "commit 45" tmp' test_expect_success 'find commit 46' 'grep "commit 46" tmp' test_expect_success 'find commit 50' 'grep "commit 50" tmp' -- cgit v2.8.0