summaryrefslogtreecommitdiffabout
authorLars Hjemli <larsh@hatman.(none)>2008-07-19 18:40:30 (UTC)
committer Lars Hjemli <larsh@hatman.(none)>2008-07-19 18:47:39 (UTC)
commit502865a5ec40fed5f1f865cb34002aecaab8405e (patch) (side-by-side diff)
treeab53ab68d6c56948502287ff3cdad45c409aebbb
parentde5e9281719809c5b07051faa88e95bd16e8d485 (diff)
downloadcgit-502865a5ec40fed5f1f865cb34002aecaab8405e.zip
cgit-502865a5ec40fed5f1f865cb34002aecaab8405e.tar.gz
cgit-502865a5ec40fed5f1f865cb34002aecaab8405e.tar.bz2
Add a favicon option to cgitrc
This option is used to specify a shortcut icon on all cgit pages. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--cgit.h1
-rw-r--r--cgitrc2
-rw-r--r--ui-shared.c5
4 files changed, 10 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index 8f154c9..8795085 100644
--- a/cgit.c
+++ b/cgit.c
@@ -16,24 +16,26 @@
const char *cgit_version = CGIT_VERSION;
void config_cb(const char *name, const char *value)
{
if (!strcmp(name, "root-title"))
ctx.cfg.root_title = xstrdup(value);
else if (!strcmp(name, "root-desc"))
ctx.cfg.root_desc = xstrdup(value);
else if (!strcmp(name, "root-readme"))
ctx.cfg.root_readme = xstrdup(value);
else if (!strcmp(name, "css"))
ctx.cfg.css = xstrdup(value);
+ else if (!strcmp(name, "favicon"))
+ ctx.cfg.favicon = xstrdup(value);
else if (!strcmp(name, "footer"))
ctx.cfg.footer = xstrdup(value);
else if (!strcmp(name, "logo"))
ctx.cfg.logo = xstrdup(value);
else if (!strcmp(name, "index-header"))
ctx.cfg.index_header = xstrdup(value);
else if (!strcmp(name, "index-info"))
ctx.cfg.index_info = xstrdup(value);
else if (!strcmp(name, "logo-link"))
ctx.cfg.logo_link = xstrdup(value);
else if (!strcmp(name, "module-link"))
ctx.cfg.module_link = xstrdup(value);
diff --git a/cgit.h b/cgit.h
index d18d9ca..7881aca 100644
--- a/cgit.h
+++ b/cgit.h
@@ -116,24 +116,25 @@ struct cgit_query {
char *sha2;
char *path;
char *name;
char *mimetype;
int ofs;
};
struct cgit_config {
char *agefile;
char *cache_root;
char *clone_prefix;
char *css;
+ char *favicon;
char *footer;
char *index_header;
char *index_info;
char *logo;
char *logo_link;
char *module_link;
char *repo_group;
char *robots;
char *root_title;
char *root_desc;
char *root_readme;
char *script_name;
diff --git a/cgitrc b/cgitrc
index f1d8997..9e8a0f2 100644
--- a/cgitrc
+++ b/cgitrc
@@ -98,24 +98,26 @@
## sidebar on the repository index page
#index-info=
## If specified, the file at this path will be included as HTML above
## the repository index
#index-header=
## Link to css file
#css=/cgit/cgit.css
+## Link to favicon
+#favicon=/favicon.ico
## Link to logo file
#logo=/cgit/git-logo.png
## Url loaded when clicking the logo
#logo-link=http://www.kernel.org/pub/software/scm/git/docs/
## Url loaded when clicking a submodule link
#module-link=./?repo=%s&page=commit&id=%s
diff --git a/ui-shared.c b/ui-shared.c
index 8a00099..6f83d2a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -428,24 +428,29 @@ void cgit_print_docstart(struct cgit_context *ctx)
html(cgit_doctype);
html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n");
html("<head>\n");
html("<title>");
html_txt(ctx->page.title);
html("</title>\n");
htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version);
if (ctx->cfg.robots && *ctx->cfg.robots)
htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots);
html("<link rel='stylesheet' type='text/css' href='");
html_attr(ctx->cfg.css);
html("'/>\n");
+ if (ctx->cfg.favicon) {
+ html("<link rel='shortcut icon' href='");
+ html_attr(ctx->cfg.favicon);
+ html("'/>\n");
+ }
html("</head>\n");
html("<body>\n");
}
void cgit_print_docend()
{
html("</div>");
if (ctx.cfg.footer)
html_include(ctx.cfg.footer);
else {
html("<div class='footer'>generated ");
cgit_print_date(time(NULL), FMT_LONGDATE);