[PATCH 3/3] ui-shared: add rel-vcs microformat links to HTML header

John Keeping john at keeping.me.uk
Fri Aug 1 23:14:19 CEST 2014


As described at https://joeyh.name/rfc/rel-vcs/.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 ui-shared.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ui-shared.c b/ui-shared.c
index 5bae02d..9ac65ab 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -661,6 +661,15 @@ void cgit_print_http_headers(void)
 		exit(0);
 }
 
+static void print_rel_vcs_link(const char *url)
+{
+	html("<link rel='vcs-git' href='");
+	html_attr(url);
+	html("' title='");
+	html_attr(ctx.repo->name);
+	html(" Git repository'/>\n");
+}
+
 void cgit_print_docstart(void)
 {
 	if (ctx.cfg.embedded) {
@@ -699,6 +708,8 @@ void cgit_print_docstart(void)
 		html("' type='application/atom+xml'/>\n");
 		strbuf_release(&sb);
 	}
+	if (ctx.repo)
+		cgit_add_clone_urls(print_rel_vcs_link);
 	if (ctx.cfg.head_include)
 		html_include(ctx.cfg.head_include);
 	html("</head>\n");
-- 
2.0.3.890.g700db9e



More information about the CGit mailing list