about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJason A. Donenfeld2018-02-12 23:10:06 +0100
committerJason A. Donenfeld2018-07-03 20:37:00 +0200
commitb522a302c9c4fb9fd9e1ea829ee990afc74980ca (patch)
treeb1815354f08c1a16fb9d9c6d15dbe51bc3accbfd
parentUse string list strdup_strings for mimetypes (diff)
downloadcgit-b522a302c9c4fb9fd9e1ea829ee990afc74980ca.tar.gz
cgit-b522a302c9c4fb9fd9e1ea829ee990afc74980ca.zip
extra-head-content: introduce another option for meta tags
This is to support things like go-import meta tags, which are on a
per-repo basis.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--cgit.c4
-rw-r--r--cgit.h1
-rw-r--r--cgitrc.5.txt4
-rw-r--r--shared.c1
-rw-r--r--ui-shared.c2
5 files changed, 12 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c index 0c9f3e9..e2d7891 100644 --- a/cgit.c +++ b/cgit.c
@@ -46,6 +46,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va
46 repo->homepage = xstrdup(value); 46 repo->homepage = xstrdup(value);
47 else if (!strcmp(name, "defbranch")) 47 else if (!strcmp(name, "defbranch"))
48 repo->defbranch = xstrdup(value); 48 repo->defbranch = xstrdup(value);
49 else if (!strcmp(name, "extra-head-content"))
50 repo->extra_head_content = xstrdup(value);
49 else if (!strcmp(name, "snapshots")) 51 else if (!strcmp(name, "snapshots"))
50 repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value); 52 repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value);
51 else if (!strcmp(name, "enable-commit-graph")) 53 else if (!strcmp(name, "enable-commit-graph"))
@@ -797,6 +799,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo)
797 } 799 }
798 if (repo->defbranch) 800 if (repo->defbranch)
799 fprintf(f, "repo.defbranch=%s\n", repo->defbranch); 801 fprintf(f, "repo.defbranch=%s\n", repo->defbranch);
802 if (repo->extra_head_content)
803 fprintf(f, "repo.extra-head-content=%s\n", repo->extra_head_content);
800 if (repo->module_link) 804 if (repo->module_link)
801 fprintf(f, "repo.module-link=%s\n", repo->module_link); 805 fprintf(f, "repo.module-link=%s\n", repo->module_link);
802 if (repo->section) 806 if (repo->section)
diff --git a/cgit.h b/cgit.h index 6feca68..32dfd7a 100644 --- a/cgit.h +++ b/cgit.h
@@ -81,6 +81,7 @@ struct cgit_repo {
81 char *name; 81 char *name;
82 char *path; 82 char *path;
83 char *desc; 83 char *desc;
84 char *extra_head_content;
84 char *owner; 85 char *owner;
85 char *homepage; 86 char *homepage;
86 char *defbranch; 87 char *defbranch;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index f6f6502..6f008cc 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt
@@ -509,6 +509,10 @@ repo.enable-subject-links::
509 A flag which can be used to override the global setting 509 A flag which can be used to override the global setting
510 `enable-subject-links'. Default value: none. 510 `enable-subject-links'. Default value: none.
511 511
512repo.extra-head-content::
513 This value will be added verbatim to the head section of each page
514 displayed for this repo. Default value: none.
515
512repo.hide:: 516repo.hide::
513 Flag which, when set to "1", hides the repository from the repository 517 Flag which, when set to "1", hides the repository from the repository
514 index. The repository can still be accessed by providing a direct path. 518 index. The repository can still be accessed by providing a direct path.
diff --git a/shared.c b/shared.c index d7c7636..f7b64cf 100644 --- a/shared.c +++ b/shared.c
@@ -53,6 +53,7 @@ struct cgit_repo *cgit_add_repo(const char *url)
53 ret->name = ret->url; 53 ret->name = ret->url;
54 ret->path = NULL; 54 ret->path = NULL;
55 ret->desc = cgit_default_repo_desc; 55 ret->desc = cgit_default_repo_desc;
56 ret->extra_head_content = NULL;
56 ret->owner = NULL; 57 ret->owner = NULL;
57 ret->homepage = NULL; 58 ret->homepage = NULL;
58 ret->section = ctx.cfg.section; 59 ret->section = ctx.cfg.section;
diff --git a/ui-shared.c b/ui-shared.c index a63dcb0..9a2e382 100644 --- a/ui-shared.c +++ b/ui-shared.c
@@ -775,6 +775,8 @@ void cgit_print_docstart(void)
775 cgit_add_clone_urls(print_rel_vcs_link); 775 cgit_add_clone_urls(print_rel_vcs_link);
776 if (ctx.cfg.head_include) 776 if (ctx.cfg.head_include)
777 html_include(ctx.cfg.head_include); 777 html_include(ctx.cfg.head_include);
778 if (ctx.repo && ctx.repo->extra_head_content)
779 html(ctx.repo->extra_head_content);
778 html("</head>\n"); 780 html("</head>\n");
779 html("<body>\n"); 781 html("<body>\n");
780 if (ctx.cfg.header) 782 if (ctx.cfg.header)