All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] gitweb: provide a way to customize html headers
@ 2011-10-17  7:28 Lénaïc Huard
  2011-10-17 11:56 ` Jakub Narebski
  0 siblings, 1 reply; 8+ messages in thread
From: Lénaïc Huard @ 2011-10-17  7:28 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski <jnareb@gmail.com> writes:

> Lénaïc Huard <lenaic@lhuard.fr.eu.org> writes:

> > This allows web sites to add some specific html headers to the pages
> > generated by gitweb.

> What do you need this for?

I want to decorate the gitweb pages with the “Google Analytics” tracking code.
In order to do so, today, Google is recommending to add a <script> tag just 
before the closing </head> tag.

https://www.google.com/support/analyticshelp/bin/answer.py?answer=1008080&hl=en

> > The new variable $site_htmlheader can be set to a filename the content
> > of which will be inserted at the end of the <head> section of each
> > page generated by gitweb.

> Hmmm... I wonder if a file with html header fragment (which is quite
> specific subset of HTML) is a best solution.

That’s true. The piece of code to be inserted in <head> is maybe small enough 
so that we don’t need a file. Maybe $site_htmlheader could contain directly 
the html snippet to be inserted in the pages?

> > Signed-off-by: L=FE=FF=00=E9na=FE=FF=00=EFc Huard <lenaic@lhuard.fr.eu.or=
g>
> > ---
> >  gitweb/INSTALL     |    3 +++

> Nb. there is patch in flight adding gitweb.conf(5) and gitweb(1)
> manpages...

Ok. So, I’ll update them once a decision will be taken concerning this 
$site_htmlheader.
-- 
Lénaïc Huard

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

* Re: [PATCH] gitweb: provide a way to customize html headers
  2011-10-17  7:28 [PATCH] gitweb: provide a way to customize html headers Lénaïc Huard
@ 2011-10-17 11:56 ` Jakub Narebski
  2011-10-20 22:46   ` Lénaïc Huard
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Narebski @ 2011-10-17 11:56 UTC (permalink / raw)
  To: Lénaïc Huard; +Cc: git

On Mon, 17 Oct 2011, Lénaïc Huard wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > Lénaïc Huard <lenaic@lhuard.fr.eu.org> writes:
> 
> > > This allows web sites to add some specific html headers to the pages
> > > generated by gitweb.
> 
> > What do you need this for?
> 
> I want to decorate the gitweb pages with the “Google Analytics” tracking code.
> In order to do so, today, Google is recommending to add a <script> tag just 
> before the closing </head> tag.
> 
> https://www.google.com/support/analyticshelp/bin/answer.py?answer=1008080&hl=en

Hmmm... the modern recommendation from both Google and Yahoo is to put
script tags at the end of HTML, just before closing </body>, which you
can do nowadays with $site_footer / GITWEB_SITE_FOOTER.

But I guess that analytics script needs to be loaded earlier.

> > > The new variable $site_htmlheader can be set to a filename the content
> > > of which will be inserted at the end of the <head> section of each
> > > page generated by gitweb.
> 
> > Hmmm... I wonder if a file with html header fragment (which is quite
> > specific subset of HTML) is a best solution.
> 
> That’s true. The piece of code to be inserted in <head> is maybe small enough 
> so that we don’t need a file. Maybe $site_htmlheader could contain directly 
> the html snippet to be inserted in the pages?

I think it might be a better solution.
 

> > > ---
> > >  gitweb/INSTALL     |    3 +++
> 
> > Nb. there is patch in flight adding gitweb.conf(5) and gitweb(1)
> > manpages...
> 
> Ok. So, I’ll update them once a decision will be taken concerning this 
> $site_htmlheader.

You might have to wait a bit till patches containing gitweb.conf(5)
manpage are merged in, and rebase your patch to add information about
new config variable not to gitweb/INSTALL, but to Documentation/gitweb.conf.txt

-- 
Jakub Narebski
Poland

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

* Re: [PATCH] gitweb: provide a way to customize html headers
  2011-10-17 11:56 ` Jakub Narebski
@ 2011-10-20 22:46   ` Lénaïc Huard
  2011-10-21  0:37     ` Junio C Hamano
  2011-10-21 19:14     ` Jakub Narebski
  0 siblings, 2 replies; 8+ messages in thread
From: Lénaïc Huard @ 2011-10-20 22:46 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

This allows web sites to add some specific html headers to the pages
generated by gitweb.

The new variable $site_htmlheader 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 <lenaic@lhuard.fr.eu.org>
---
Le lundi 17 octobre 2011, Jakub Narebski a écrit :
> On Mon, 17 Oct 2011, Lénaïc Huard wrote:
> > Jakub Narebski <jnareb@gmail.com> writes:
> > > Lénaïc Huard <lenaic@lhuard.fr.eu.org> writes:
> > > > This allows web sites to add some specific html headers to the pages
> > > > generated by gitweb.
> > > 
> > > What do you need this for?
> > 
> > I want to decorate the gitweb pages with the “Google Analytics” tracking
> > code. In order to do so, today, Google is recommending to add a <script>
> > tag just before the closing </head> tag.
> > 
> > https://www.google.com/support/analyticshelp/bin/answer.py?answer=1008080
> > &hl=en
> 
> Hmmm... the modern recommendation from both Google and Yahoo is to put
> script tags at the end of HTML, just before closing </body>, which you
> can do nowadays with $site_footer / GITWEB_SITE_FOOTER.
> 
> But I guess that analytics script needs to be loaded earlier.

In fact, I used to insert the Google Analytics tracking code before </body>,
but I recently noticed that Google is now recommending to put the html
snippet at the end of the <head> section.

Here is the recommendation from Google:
https://code.google.com/apis/analytics/docs/tracking/asyncTracking.html

From what I understood, the goal of putting the script tags just before
</body> was to avoid to increase the page load time in case of latency of
the remote server serving the js script.
The GA tracking code is now loading the js asynchronously. So, it doesn’t
block the page load anymore. So, the load can be started asap.

> > > > The new variable $site_htmlheader can be set to a filename the
> > > > content of which will be inserted at the end of the <head> section
> > > > of each page generated by gitweb.
> > > 
> > > Hmmm... I wonder if a file with html header fragment (which is quite
> > > specific subset of HTML) is a best solution.
> > 
> > That’s true. The piece of code to be inserted in <head> is maybe small
> > enough so that we don’t need a file. Maybe $site_htmlheader could
> > contain directly the html snippet to be inserted in the pages?
> 
> I think it might be a better solution.

I changed this in the patch attached in this mail. Now the variable should
contain directly the html code to be inserted.

> > > >  gitweb/INSTALL     |    3 +++
> > > 
> > > Nb. there is patch in flight adding gitweb.conf(5) and gitweb(1)
> > > manpages...
> > 
> > Ok. So, I’ll update them once a decision will be taken concerning this
> > $site_htmlheader.
> 
> You might have to wait a bit till patches containing gitweb.conf(5)
> manpage are merged in, and rebase your patch to add information about
> new config variable not to gitweb/INSTALL, but to
> Documentation/gitweb.conf.txt

I added the documentation to Documentation/gitweb.conf.txt.
But, as I noticed that gitweb/INSTALL still exists and still documents the
old variables, I left the doc of the new one.

 Documentation/gitweb.conf.txt |    5 +++++
 gitweb/INSTALL                |    2 ++
 gitweb/Makefile               |    2 ++
 gitweb/gitweb.perl            |    7 +++++++
 t/gitweb-lib.sh               |    1 +
 5 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt
index 4ca3e27..5e69c2d 100644
--- a/Documentation/gitweb.conf.txt
+++ b/Documentation/gitweb.conf.txt
@@ -364,6 +364,11 @@ $site_name::
 +
 Can be set using the `GITWEB_SITENAME` at build time.  Unset by default.
 
+$site_htmlheader::
+	HTML snippet to be included in the <head> section of each page.
+	Can be set using `GITWEB_SITE_HTMLHEADER` at build time. No default
+	value.
+
 $site_header::
 	Name of a file with HTML to be included at the top of each page.
 	Relative to the directory containing the 'gitweb.cgi' script.
diff --git a/gitweb/INSTALL b/gitweb/INSTALL
index d134ffe..a6a9f06 100644
--- a/gitweb/INSTALL
+++ b/gitweb/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_HTMLHEADER
+   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]
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 1c85b5f..ecfb311 100644
--- a/gitweb/Makefile
+++ b/gitweb/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_HTMLHEADER =
 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_HTMLHEADER++|$(GITWEB_SITE_HTMLHEADER)|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'
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 85d64b2..10b118b 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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_htmlheader = "++GITWEB_SITE_HTMLHEADER++";
 # filename of html text to include at top of each page
 our $site_header = "++GITWEB_SITE_HEADER++";
 # html text to include at home page
@@ -3879,6 +3881,11 @@ EOF
 		print "<base href=\"".esc_url($base_url)."\" />\n";
 	}
 	print_header_links($status);
+
+	if (defined $site_htmlheader) {
+		print to_utf8($site_htmlheader);
+	}
+
 	print "</head>\n" .
 	      "<body>\n";
 
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index 292753f..cfe5d74 100644
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -16,6 +16,7 @@ our \$projectroot = "$safe_pwd";
 our \$project_maxdepth = 8;
 our \$home_link_str = 'projects';
 our \$site_name = '[localhost]';
+our \$site_htmlheader = '';
 our \$site_header = '';
 our \$site_footer = '';
 our \$home_text = 'indextext.html';
-- 
1.7.7

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

* Re: [PATCH] gitweb: provide a way to customize html headers
  2011-10-20 22:46   ` Lénaïc Huard
@ 2011-10-21  0:37     ` Junio C Hamano
  2011-10-21  7:09       ` Lénaïc Huard
  2011-10-21 19:14     ` Jakub Narebski
  1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2011-10-21  0:37 UTC (permalink / raw)
  To: Lénaïc Huard; +Cc: Jakub Narebski, git

Lénaïc Huard <lenaic@lhuard.fr.eu.org> writes:

> +GITWEB_SITE_HTMLHEADER =
>  GITWEB_SITE_HEADER =
>  GITWEB_SITE_FOOTER =

Is it just me or does the inconsistency between the existing two variables
and this new one with a very similar name stand out like a sore something?

It might have been better if GITWEB_SITE_(HEADER|FOOTER) were named with
"_FILE" suffix, but as long as we consider/declare insert_file is the norm
and in-place inclusion of mini-string is an oddball, it is sufficient to
call this GITWEB_SITE_HTML_HEAD_STRING to avoid confusion?

Perhaps GITWEB_SITE_HEADER_STRING and GITWEB_SITE_FOOTER_STRING might turn
out to be useful in the future for in-place inclusion of mini-strings, and
when that happens, you two would thank me for this suggestion ;-)

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

* Re: [PATCH] gitweb: provide a way to customize html headers
  2011-10-21  0:37     ` Junio C Hamano
@ 2011-10-21  7:09       ` Lénaïc Huard
  0 siblings, 0 replies; 8+ messages in thread
From: Lénaïc Huard @ 2011-10-21  7:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jakub Narebski, git

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 <lenaic@lhuard.fr.eu.org>
---
Le vendredi 21 octobre 2011, Junio C Hamano a écrit :
> It might have been better if GITWEB_SITE_(HEADER|FOOTER) were named with
> "_FILE" suffix, but as long as we consider/declare insert_file is the norm
> and in-place inclusion of mini-string is an oddball, it is sufficient to
> call this GITWEB_SITE_HTML_HEAD_STRING to avoid confusion?

Indeed, things will be clearer like this.


 Documentation/gitweb.conf.txt |    5 +++++
 gitweb/INSTALL                |    2 ++
 gitweb/Makefile               |    2 ++
 gitweb/gitweb.perl            |    7 +++++++
 t/gitweb-lib.sh               |    1 +
 5 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt
index 4ca3e27..7aba497 100644
--- a/Documentation/gitweb.conf.txt
+++ b/Documentation/gitweb.conf.txt
@@ -364,6 +364,11 @@ $site_name::
 +
 Can be set using the `GITWEB_SITENAME` at build time.  Unset by default.
 
+$site_html_head_string::
+	HTML snippet to be included in the <head> section of each page.
+	Can be set using `GITWEB_SITE_HTML_HEAD_STRING` at build time.
+	No default value.
+
 $site_header::
 	Name of a file with HTML to be included at the top of each page.
 	Relative to the directory containing the 'gitweb.cgi' script.
diff --git a/gitweb/INSTALL b/gitweb/INSTALL
index d134ffe..6d45406 100644
--- a/gitweb/INSTALL
+++ b/gitweb/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]
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 1c85b5f..e65fc27 100644
--- a/gitweb/Makefile
+++ b/gitweb/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'
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 85d64b2..fa9b83b 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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
@@ -3879,6 +3881,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";
 
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index 292753f..21d11d6 100644
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -16,6 +16,7 @@ our \$projectroot = "$safe_pwd";
 our \$project_maxdepth = 8;
 our \$home_link_str = 'projects';
 our \$site_name = '[localhost]';
+our \$site_html_head_string = '';
 our \$site_header = '';
 our \$site_footer = '';
 our \$home_text = 'indextext.html';
-- 
1.7.7

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

* Re: [PATCH] gitweb: provide a way to customize html headers
  2011-10-20 22:46   ` Lénaïc Huard
  2011-10-21  0:37     ` Junio C Hamano
@ 2011-10-21 19:14     ` Jakub Narebski
  1 sibling, 0 replies; 8+ messages in thread
From: Jakub Narebski @ 2011-10-21 19:14 UTC (permalink / raw)
  To: Lénaïc Huard; +Cc: git

Dnia piątek 21. października 2011 00:46, Lénaïc Huard napisał:
> Le lundi 17 octobre 2011, Jakub Narebski a écrit :
>> On Mon, 17 Oct 2011, Lénaïc Huard wrote:
>>> Jakub Narebski <jnareb@gmail.com> writes:
>>>> Lénaïc Huard <lenaic@lhuard.fr.eu.org> writes:
[...]
>>>>>  gitweb/INSTALL     |    3 +++
>>>> 
>>>> Nb. there is patch in flight adding gitweb.conf(5) and gitweb(1)
>>>> manpages...
>>> 
>>> Ok. So, I’ll update them once a decision will be taken concerning this
>>> $site_htmlheader.
>> 
>> You might have to wait a bit till patches containing gitweb.conf(5)
>> manpage are merged in, and rebase your patch to add information about
>> new config variable not to gitweb/INSTALL, but to
>> Documentation/gitweb.conf.txt
> 
> I added the documentation to Documentation/gitweb.conf.txt.
> But, as I noticed that gitweb/INSTALL still exists and still documents the
> old variables, I left the doc of the new one.
> 
>  Documentation/gitweb.conf.txt |    5 +++++
>  gitweb/INSTALL                |    2 ++
>  gitweb/Makefile               |    2 ++
>  gitweb/gitweb.perl            |    7 +++++++
>  t/gitweb-lib.sh               |    1 +
>  5 files changed, 17 insertions(+), 0 deletions(-)

Well, gitweb/INSTALL documents _build_ time [make] variables, and that
didn't change with introduction of gitweb manpages.  Those are important
only during explanation.

It is only runtime _configuration_ that moved from gitweb/README (which
should be short description of project) to manpages for gitweb config.

-- 
Jakub Narebski
Poland

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

* Re: [PATCH] gitweb: provide a way to customize html headers
  2011-10-16 20:56 Lénaïc Huard
@ 2011-10-16 21:26 ` Jakub Narebski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Narebski @ 2011-10-16 21:26 UTC (permalink / raw)
  To: Lénaïc Huard; +Cc: git

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-16be, Size: 693 bytes --]

Lþÿ\0énaþÿ\0ïc Huard <lenaic@lhuard.fr.eu.org> writes:

> This allows web sites to add some specific html headers to the pages
> generated by gitweb.

What do you need this for?
 
> The new variable $site_htmlheader can be set to a filename the content
> of which will be inserted at the end of the <head> section of each
> page generated by gitweb.

Hmmm... I wonder if a file with html header fragment (which is quite
specific subset of HTML) is a best solution.

> 
> Signed-off-by: Lþÿ\0énaþÿ\0ïc Huard <lenaic@lhuard.fr.eu.org>
> ---
>  gitweb/INSTALL     |    3 +++

Nb. there is patch in flight adding gitweb.conf(5) and gitweb(1)
manpages...

-- 
Jakub Narþÿ\x01\x19bski

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

* [PATCH] gitweb: provide a way to customize html headers
@ 2011-10-16 20:56 Lénaïc Huard
  2011-10-16 21:26 ` Jakub Narebski
  0 siblings, 1 reply; 8+ messages in thread
From: Lénaïc Huard @ 2011-10-16 20:56 UTC (permalink / raw)
  To: git

This allows web sites to add some specific html headers to the pages
generated by gitweb.

The new variable $site_htmlheader can be set to a filename the content
of which will be inserted at the end of the <head> section of each
page generated by gitweb.

Signed-off-by: Lénaïc Huard <lenaic@lhuard.fr.eu.org>
---
 gitweb/INSTALL     |    3 +++
 gitweb/Makefile    |    2 ++
 gitweb/gitweb.perl |    7 +++++++
 t/gitweb-lib.sh    |    1 +
 4 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/gitweb/INSTALL b/gitweb/INSTALL
index f5efe74..e23eafa 100644
--- a/gitweb/INSTALL
+++ b/gitweb/INSTALL
@@ -130,6 +130,9 @@ 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_HTMLHEADER
+   Filename of html code to include in the <head> section of each page.
+   Relative to gitweb.cgi script.  [No default]
  * GITWEB_SITE_HEADER
    Filename of html text to include at top of each page.  Relative to
    gitweb.cgi script.  [No default]
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 1c85b5f..ecfb311 100644
--- a/gitweb/Makefile
+++ b/gitweb/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_HTMLHEADER =
 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_HTMLHEADER++|$(GITWEB_SITE_HTMLHEADER)|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'
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 85d64b2..63b0115 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -85,6 +85,8 @@ our $home_link_str = "++GITWEB_HOME_LINK_STR++";
 our $site_name = "++GITWEB_SITENAME++"
                  || ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
 
+# filename of html code to include in the <head> section of each page
+our $site_htmlheader = "++GITWEB_SITE_HTMLHEADER++";
 # filename of html text to include at top of each page
 our $site_header = "++GITWEB_SITE_HEADER++";
 # html text to include at home page
@@ -3879,6 +3881,11 @@ EOF
                print "<base href=\"".esc_url($base_url)."\" />\n";
        }
        print_header_links($status);
+
+       if (defined $site_htmlheader && -f $site_htmlheader) {
+               insert_file($site_htmlheader);
+       }
+
        print "</head>\n" .
              "<body>\n";
 
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index 292753f..cfe5d74 100644
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -16,6 +16,7 @@ our \$projectroot = "$safe_pwd";
 our \$project_maxdepth = 8;
 our \$home_link_str = 'projects';
 our \$site_name = '[localhost]';
+our \$site_htmlheader = '';
 our \$site_header = '';
 our \$site_footer = '';
 our \$home_text = 'indextext.html';
-- 
1.7.7

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

end of thread, other threads:[~2011-10-21 19:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-17  7:28 [PATCH] gitweb: provide a way to customize html headers Lénaïc Huard
2011-10-17 11:56 ` Jakub Narebski
2011-10-20 22:46   ` Lénaïc Huard
2011-10-21  0:37     ` Junio C Hamano
2011-10-21  7:09       ` Lénaïc Huard
2011-10-21 19:14     ` Jakub Narebski
  -- strict thread matches above, loose matches on Subject: below --
2011-10-16 20:56 Lénaïc Huard
2011-10-16 21:26 ` Jakub Narebski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.