help / color / mirror / Atom feed
From: Abigail G <>
Subject: [PATCH] man.cgi: support inserting HTML code into <HEAD>
Date: Mon, 07 Nov 2022 12:49:55 -0500	[thread overview]
Message-ID: <> (raw)

Similar to the header.html and footer.html files, this allows
downstream users to include their own set of meta and other tags.

Index: cgi.c
RCS file: /cvs/mandoc/cgi.c,v
retrieving revision 1.180
diff -u -r1.180 cgi.c
--- cgi.c	6 Jul 2022 17:21:04 -0000	1.180
+++ cgi.c	7 Nov 2022 17:32:35 -0000
@@ -413,11 +413,14 @@
 			printf("(%.*s)", secsz, sec);
 		fputs(" - ", stdout);
-	printf("%s</title>\n"
-	      "</head>\n"
-	      "<body>\n",
+	printf("%s</title>\n",
+	resp_copy(NULL, MAN_DIR "/head.html");
+	printf("</head>\n"
+	      "<body>\n");
 	return resp_copy("header", MAN_DIR "/header.html");
Index: man.cgi.3
RCS file: /cvs/mandoc/man.cgi.3,v
retrieving revision 1.4
diff -u -r1.4 man.cgi.3
--- man.cgi.3	15 Mar 2017 13:18:53 -0000	1.4
+++ man.cgi.3	7 Nov 2022 17:32:35 -0000
@@ -240,8 +240,10 @@
 .It Ft void Fn resp_begin_html "int code" "const char *msg" "const char *file"
 This generator calls
 .Fn resp_begin_http
-to print the HTTP headers, then prints the HTML header up to the
-opening tag of the <body> element, then copies the file
+to print the HTTP headers, then prints the HTML header, then copies the file
+.Pa head.html
+to the output, if it exists and is readable, then prints up to the opening tag
+of the <body> element, then copies the file
 .Pa header.html
 to the output, if it exists and is readable.
Index: man.cgi.8
RCS file: /cvs/mandoc/man.cgi.8,v
retrieving revision 1.24
diff -u -r1.24 man.cgi.8
--- man.cgi.8	6 Jul 2022 15:47:28 -0000	1.24
+++ man.cgi.8	7 Nov 2022 17:32:35 -0000
@@ -199,6 +199,7 @@
 for this purpose.
 The files
 .Pa manpath.conf ,
+.Pa head.html ,
 .Pa header.html ,
 .Pa footer.html
@@ -380,6 +381,10 @@
 .Sx Restricted character set ,
 reports an internal server error and exits without doing anything.
+.It Pa /man/head.html
+An optional file containing static HTML code to be inserted right before
+closing the <HEAD> element.
+For example, it can contain additional <META> tags or <LINK>s to other resources.
 .It Pa /man/header.html
 An optional file containing static HTML code to be wrapped in
 a <HEADER> element and inserted right after opening the <BODY> element.
 To unsubscribe send an email to

                 reply	other threads:[~2022-11-07 17:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).