From mboxrd@z Thu Jan 1 00:00:00 1970
From: =?utf-8?q?L=C3=A9na=C3=AFc_Huard?=
, which yo= u > can do nowadays with $site_footer / GITWEB_SITE_FOOTER. >=20 > But I guess that analytics script needs to be loaded earlier. In fact, I used to insert the Google Analytics tracking code before , but I recently noticed that Google is now recommending to put the html snippet at the end of the
section. Here is the recommendation from Google: https://code.google.com/apis/analytics/docs/tracking/asyncTracking.html =46rom what I understood, the goal of putting the script tags just befo= re 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= =E2=80=99t 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
sect= ion > > > > of each page generated by gitweb. > > >=20 > > > Hmmm... I wonder if a file with html header fragment (which is qu= ite > > > specific subset of HTML) is a best solution. > >=20 > > That=E2=80=99s true. The piece of code to be inserted in
is = maybe small > > enough so that we don=E2=80=99t need a file. Maybe $site_htmlheader= could > > contain directly the html snippet to be inserted in the pages? >=20 > I think it might be a better solution. I changed this in the patch attached in this mail. Now the variable sho= uld contain directly the html code to be inserted. > > > > gitweb/INSTALL | 3 +++ > > >=20 > > > Nb. there is patch in flight adding gitweb.conf(5) and gitweb(1) > > > manpages... > >=20 > > Ok. So, I=E2=80=99ll update them once a decision will be taken conc= erning this > > $site_htmlheader. >=20 > 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 defaul= t. =20 +$site_htmlheader:: + HTML snippet to be included in the
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 variabl= es 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
section of each page. [No def= ault] * 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 =3D static/gitweb.css GITWEB_LOGO =3D static/git-logo.png GITWEB_FAVICON =3D static/git-favicon.png GITWEB_JS =3D static/gitweb.js +GITWEB_SITE_HTMLHEADER =3D GITWEB_SITE_HEADER =3D GITWEB_SITE_FOOTER =3D HIGHLIGHT_BIN =3D highlight @@ -144,6 +145,7 @@ GITWEB_REPLACE =3D \ -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 =3D "++GITWEB_HOME_LINK_STR++"; our $site_name =3D "++GITWEB_SITENAME++" || ($ENV{'SERVER_NAME'} || "Untitled") . " Git"; =20 +# html snippet to include in the
section of each page
+our $site_htmlheader =3D "++GITWEB_SITE_HTMLHEADER++";
# filename of html text to include at top of each page
our $site_header =3D "++GITWEB_SITE_HEADER++";
# html text to include at home page
@@ -3879,6 +3881,11 @@ EOF
print "