diff options
Diffstat (limited to '')
| -rw-r--r-- | source/ui-shared.c | 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rwxr-xr-x | tests/t0102-summary.sh | 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 files changed, 15 insertions, 0 deletions
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("</title>\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("<meta name='description' content='"); + html_attr(ctx.repo->desc); + html("'>\n"); + } else if (!ctx.repo && ctx.cfg.root_desc && *ctx.cfg.root_desc) { + html("<meta name='description' content='"); + html_attr(ctx.cfg.root_desc); + html("'>\n"); + } htmlf("<meta name='generator' content='cgit %s'>\n", cgit_version); if (ctx.cfg.robots && *ctx.cfg.robots) { html("<meta name='robots' content='"); diff --git a/tests/t0102-summary.sh b/tests/t0102-summary.sh index a953ce3..79f2b11 100755 --- a/tests/t0102-summary.sh +++ b/tests/t0102-summary.sh @@ -20,6 +20,9 @@ test_expect_success 'clone-url expanded correctly' ' ' test_expect_success 'generate bar summary' 'cgit_url "bar" >tmp' +test_expect_success 'repo description reaches the meta tag' ' + grep "<meta name=.description. content=.the bar repo.>" 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' |
