]> git.cameronkatri.com Git - cgit.git/commitdiff
ui-shared: add rel-vcs microformat links to HTML header
authorJohn Keeping <john@keeping.me.uk>
Fri, 1 Aug 2014 21:14:19 +0000 (22:14 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 24 Dec 2014 02:04:21 +0000 (19:04 -0700)
As described at https://joeyh.name/rfc/rel-vcs/.

Signed-off-by: John Keeping <john@keeping.me.uk>
ui-shared.c

index 4e317d012639d5fdd196eb5ff5e08174b89a89ed..cd97ffb6f04c691e3729fadc8c3e8f054bdce6c3 100644 (file)
@@ -660,6 +660,15 @@ void cgit_print_http_headers(void)
                exit(0);
 }
 
                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) {
 void cgit_print_docstart(void)
 {
        if (ctx.cfg.embedded) {
@@ -698,6 +707,8 @@ void cgit_print_docstart(void)
                html("' type='application/atom+xml'/>\n");
                strbuf_release(&sb);
        }
                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");
        if (ctx.cfg.head_include)
                html_include(ctx.cfg.head_include);
        html("</head>\n");