diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Add a meta description to the page head
Diffstat (limited to '')
-rw-r--r--source/ui-shared.c12
1 file changed, 12 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='");