Skip to content

Commit 208a1cc

Browse files
committed
Merge branch 'lh/gitweb-site-html-head'
* lh/gitweb-site-html-head: gitweb: provide a way to customize html headers
2 parents 2ef89f3 + c1355b7 commit 208a1cc

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

Documentation/gitweb.conf.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,11 @@ $site_name::
364364
+
365365
Can be set using the `GITWEB_SITENAME` at build time. Unset by default.
366366

367+
$site_html_head_string::
368+
HTML snippet to be included in the <head> section of each page.
369+
Can be set using `GITWEB_SITE_HTML_HEAD_STRING` at build time.
370+
No default value.
371+
367372
$site_header::
368373
Name of a file with HTML to be included at the top of each page.
369374
Relative to the directory containing the 'gitweb.cgi' script.

gitweb/INSTALL

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ You can specify the following configuration variables when building GIT:
130130
Points to an .html file which is included on the gitweb project
131131
overview page ('projects_list' view), if it exists. Relative to
132132
gitweb.cgi script. [Default: indextext.html]
133+
* GITWEB_SITE_HTML_HEAD_STRING
134+
html snippet to include in the <head> section of each page. [No default]
133135
* GITWEB_SITE_HEADER
134136
Filename of html text to include at top of each page. Relative to
135137
gitweb.cgi script. [No default]

gitweb/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ GITWEB_CSS = static/gitweb.css
3434
GITWEB_LOGO = static/git-logo.png
3535
GITWEB_FAVICON = static/git-favicon.png
3636
GITWEB_JS = static/gitweb.js
37+
GITWEB_SITE_HTML_HEAD_STRING =
3738
GITWEB_SITE_HEADER =
3839
GITWEB_SITE_FOOTER =
3940
HIGHLIGHT_BIN = highlight
@@ -144,6 +145,7 @@ GITWEB_REPLACE = \
144145
-e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
145146
-e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
146147
-e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
148+
-e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
147149
-e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
148150
-e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
149151
-e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'

gitweb/gitweb.perl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ sub evaluate_uri {
8585
our $site_name = "++GITWEB_SITENAME++"
8686
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
8787

88+
# html snippet to include in the <head> section of each page
89+
our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
8890
# filename of html text to include at top of each page
8991
our $site_header = "++GITWEB_SITE_HEADER++";
9092
# html text to include at home page
@@ -3879,6 +3881,11 @@ sub git_header_html {
38793881
print "<base href=\"".esc_url($base_url)."\" />\n";
38803882
}
38813883
print_header_links($status);
3884+
3885+
if (defined $site_html_head_string) {
3886+
print to_utf8($site_html_head_string);
3887+
}
3888+
38823889
print "</head>\n" .
38833890
"<body>\n";
38843891

t/gitweb-lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ our \$projectroot = "$safe_pwd";
1616
our \$project_maxdepth = 8;
1717
our \$home_link_str = 'projects';
1818
our \$site_name = '[localhost]';
19+
our \$site_html_head_string = '';
1920
our \$site_header = '';
2021
our \$site_footer = '';
2122
our \$home_text = 'indextext.html';

0 commit comments

Comments
 (0)