author | Lars Hjemli <hjemli@gmail.com> | 2007-11-11 20:57:21 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-11-11 20:57:21 (UTC) |
commit | d267d88c9cb1fb4a45120b86e410ab604626c6bb (patch) (side-by-side diff) | |
tree | 55ee3a76da83a6272e446f5201928fe1753ea30d | |
parent | 1b7c5b2e0b918e9452694aace7c19194683989a8 (diff) | |
download | cgit-d267d88c9cb1fb4a45120b86e410ab604626c6bb.zip cgit-d267d88c9cb1fb4a45120b86e410ab604626c6bb.tar.gz cgit-d267d88c9cb1fb4a45120b86e410ab604626c6bb.tar.bz2 |
Add support for "robots" meta-tag
With this change, cgit will start to generate the "robots" meta-tag, using
a default value of "index, nofollow".
The default value can be modified with a new cgitrc variable, "robots".
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc | 5 | ||||
-rw-r--r-- | shared.c | 3 | ||||
-rw-r--r-- | ui-shared.c | 2 |
4 files changed, 11 insertions, 0 deletions
@@ -141,2 +141,3 @@ extern char *cgit_cache_root; extern char *cgit_repo_group; +extern char *cgit_robots; @@ -10,2 +10,7 @@ +## This variable can be used to override the default value for "robots" +## meta-tag. If unset, the meta-tag isn't generated. +#robots=index, nofollow + + ## Set allowed snapshot types by default. Can be overridden per repo @@ -28,2 +28,3 @@ char *cgit_cache_root = CGIT_CACHE_ROOT; char *cgit_repo_group = NULL; +char *cgit_robots = "index, nofollow"; @@ -199,2 +200,4 @@ void cgit_global_config_cb(const char *name, const char *value) cgit_renamelimit = atoi(value); + else if (!strcmp(name, "robots")) + cgit_robots = xstrdup(value); else if (!strcmp(name, "repo.group")) diff --git a/ui-shared.c b/ui-shared.c index 5192800..2f771da 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -366,2 +366,4 @@ void cgit_print_docstart(char *title, struct cacheitem *item) htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); + if (cgit_robots && *cgit_robots) + htmlf("<meta name='robots' content='%s'/>\n", cgit_robots); html("<link rel='stylesheet' type='text/css' href='"); |