[PATCH] add 'go-import' meta tag if in a repo

Derek Stevens nilix at nilfm.cc
Sat Jan 8 23:55:59 UTC 2022


Signed-off-by: Derek Stevens <nilix at nilfm.cc>
---
 ui-shared.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui-shared.c b/ui-shared.c
index acd8ab5..0f57af6 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -785,6 +785,9 @@ void cgit_print_docstart(void)
 	html_txt(ctx.page.title);
 	html("</title>\n");
 	htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version);
+	if (ctx.repo)
+	  htmlf("<meta name='go-import' content='%s%s%s git https://%s%s%s'/>\n",
+	    host, cgit_rooturl(), ctx.repo->url, host, cgit_rooturl(), ctx.repo->url);
 	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='");
-- 
2.34.1



More information about the CGit mailing list