]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: provide a way to customize html headers
authorLénaïc Huard <redacted>
Fri, 21 Oct 2011 07:09:29 +0000 (09:09 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:31 +0000 (00:51 -0400)
This allows web sites to add some specific html headers to the pages
generated by gitweb.

The new variable $site_html_head_string can be set to an html snippet that
will be inserted at the end of the <head> section of each page generated
by gitweb.

Signed-off-by: Lénaïc Huard <redacted>
Signed-off-by: Junio C Hamano <redacted>
INSTALL
Makefile
gitweb.perl

diff --git a/INSTALL b/INSTALL
index 921c42792a783842851196c43b734d8da4e8f90f8bdd49927b3f385d0623b190..2892fe1499f0bcb144ce6e02d8d87b218544d35bcb2e17ca6d1895ef13028048 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -130,6 +130,8 @@ You can specify the following configuration variables when building GIT:
    Points to an .html file which is included on the gitweb project
    overview page ('projects_list' view), if it exists.  Relative to
    gitweb.cgi script.  [Default: indextext.html]
+ * GITWEB_SITE_HTML_HEAD_STRING
+   html snippet to include in the <head> section of each page. [No default]
  * GITWEB_SITE_HEADER
    Filename of html text to include at top of each page.  Relative to
    gitweb.cgi script.  [No default]
index 7118540943ffe5ba341bc95b2a7258458b9c451dc9b26697770eeccb18c76809..0a51dd665de2c1040fc4e7638a8c4d945af7108d2487b2d46219c7dde289b5ca 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,7 @@ GITWEB_CSS = static/gitweb.css
 GITWEB_LOGO = static/git-logo.png
 GITWEB_FAVICON = static/git-favicon.png
 GITWEB_JS = static/gitweb.js
+GITWEB_SITE_HTML_HEAD_STRING =
 GITWEB_SITE_HEADER =
 GITWEB_SITE_FOOTER =
 HIGHLIGHT_BIN = highlight
@@ -144,6 +145,7 @@ GITWEB_REPLACE = \
        -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
        -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
        -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
+       -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
        -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
        -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
        -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
index 3a8a2f0285bc72971d6f45521883981042f487adbb223b9ac816faf237dec3b1..944898b1c91b08eb65c4d588b0c0933c059f1ebe6a9708a71ecb284a264c90ec 100755 (executable)
@@ -85,6 +85,8 @@ our $home_link_str = "++GITWEB_HOME_LINK_STR++";
 our $site_name = "++GITWEB_SITENAME++"
                  || ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
 
+# html snippet to include in the <head> section of each page
+our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
 # filename of html text to include at top of each page
 our $site_header = "++GITWEB_SITE_HEADER++";
 # html text to include at home page
@@ -3880,6 +3882,11 @@ EOF
                print "<base href=\"".esc_url($base_url)."\" />\n";
        }
        print_header_links($status);
+
+       if (defined $site_html_head_string) {
+               print to_utf8($site_html_head_string);
+       }
+
        print "</head>\n" .
              "<body>\n";
 
This page took 0.325243 seconds and 4 git commands to generate.