List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH] add 'go-import' meta tag if in a repo
@ 2022-01-08 23:55 Derek Stevens
  2022-01-09 14:23 ` John Keeping
  0 siblings, 1 reply; 4+ messages in thread
From: Derek Stevens @ 2022-01-08 23:55 UTC (permalink / raw)
  To: cgit; +Cc: Derek Stevens

Signed-off-by: Derek Stevens <nilix@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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add 'go-import' meta tag if in a repo
  2022-01-08 23:55 [PATCH] add 'go-import' meta tag if in a repo Derek Stevens
@ 2022-01-09 14:23 ` John Keeping
  0 siblings, 0 replies; 4+ messages in thread
From: John Keeping @ 2022-01-09 14:23 UTC (permalink / raw)
  To: Derek Stevens; +Cc: cgit

Please include some description here about why this change is desirable.

On Sat, Jan 08, 2022 at 04:55:59PM -0700, Derek Stevens wrote:
> Signed-off-by: Derek Stevens <nilix@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);

The indentation looks wrong here...

>  	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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add 'go-import' meta tag if in a repo
       [not found] ` <dc347023-fb80-4c44-b75a-1fd2b05e463c@www.fastmail.com>
@ 2022-05-09 14:57   ` Derek Stevens
  0 siblings, 0 replies; 4+ messages in thread
From: Derek Stevens @ 2022-05-09 14:57 UTC (permalink / raw)
  To: Max Resnick; +Cc: cgit

I've been really busy with life lately so I don't mind if you take it on!

Cheers,
Derek

"Max Resnick" <max_resnick@fastmail.fm> wrote:
> Hi are you going to complete this or would you care if I completed it? 
> 
> Thanks 
> Max
> 
> On Sun, Jan 9, 2022, at 09:45, Derek Stevens wrote:
> > Ok, I'll see about adding a config option and corresponding 
> > documentation for this, as well as make sure that my indentation is 
> > consistent.
> >
> > Thanks!
> > Derek
> >
> > ------original message------
> > From: Jamie Couture <jamie.couture@gmail.com>
> > Date: Sun, Jan 09, 2022 at 09:59:04AM MST
> >
> >> On Sat, Jan 08, 2022 at 04:55:59PM -0700, Derek Stevens wrote:
> >> > Signed-off-by: Derek Stevens <nilix@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)
> >> I recommend making this an optional feature people can opt-in and use.  
> >> Consider adding a configuration flag [1] and supporting documentation [2],
> >> allowing admins to turn a knob 'on' if they want to use this feature.
> >> 
> >> As John pointed out a minor nit: the leading whitespace should be tabs, 
> >> whereas these lines are mixed tab-and-space..
> >> 
> >> > +	  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
> >> > 
> >> 
> >> --
> >> 
> >> [1] https://git.zx2c4.com/cgit/tree/cgit.c#n42
> >> [2] https://git.zx2c4.com/cgit/tree/cgitrc.5.txt
> >
> >
> >
> > ----- End forwarded message -----
> >
> > Attachments:
> > * signature.asc



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add 'go-import' meta tag if in a repo
@ 2022-01-09 17:45 Derek Stevens
       [not found] ` <dc347023-fb80-4c44-b75a-1fd2b05e463c@www.fastmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Derek Stevens @ 2022-01-09 17:45 UTC (permalink / raw)
  To: cgit

[-- Attachment #1: Type: text/plain, Size: 1699 bytes --]

Ok, I'll see about adding a config option and corresponding documentation for this, as well as make sure that my indentation is consistent.

Thanks!
Derek

------original message------
From: Jamie Couture <jamie.couture@gmail.com>
Date: Sun, Jan 09, 2022 at 09:59:04AM MST

> On Sat, Jan 08, 2022 at 04:55:59PM -0700, Derek Stevens wrote:
> > Signed-off-by: Derek Stevens <nilix@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)
> I recommend making this an optional feature people can opt-in and use.  
> Consider adding a configuration flag [1] and supporting documentation [2],
> allowing admins to turn a knob 'on' if they want to use this feature.
> 
> As John pointed out a minor nit: the leading whitespace should be tabs, 
> whereas these lines are mixed tab-and-space..
> 
> > +	  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
> > 
> 
> --
> 
> [1] https://git.zx2c4.com/cgit/tree/cgit.c#n42
> [2] https://git.zx2c4.com/cgit/tree/cgitrc.5.txt



----- End forwarded message -----

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-09 14:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-08 23:55 [PATCH] add 'go-import' meta tag if in a repo Derek Stevens
2022-01-09 14:23 ` John Keeping
2022-01-09 17:45 Derek Stevens
     [not found] ` <dc347023-fb80-4c44-b75a-1fd2b05e463c@www.fastmail.com>
2022-05-09 14:57   ` Derek Stevens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).