From: Alan Chandler Date: Sat, 12 Nov 2005 17:50:30 GMT Subject: [Patch] gitweb added site css, header and footer Message-ID: <200511121750.30477.alan@chandlerfamily.org.uk> I wanted to include gitweb on my site - but with the ability to keep my own site header and footer. I have therefore made a few changes to enable this to happen. I also had a problem in that I had installed gitweb.cgi in /usr/lib/cgi-bin, and it was attempting to read indextext.html from this directory rather than the projectroot. I have therefore changed it to pick up this file from projectroot, and also two other files header.html and footer.html which contain the html for the header and footer of each page. Lastly, I have made a paramter at the top of the file for the the url to my site wide css file. Signed-off-by: Alan Chandler I am not sure what the netiquette is with regards these changes. I have published them as the master branch at http://www.chandlerfamily.org.uk/git/gitweb.git but I have also attached a patch below (and someone can tell me if kmail does the "right thing") What should one do about the changes to the variables at the top of the file, you will see I have changed $projectroot and $gitbin --------- diff --git a/gitweb.cgi b/gitweb.cgi index b8f1537..d16def4 100755 --- a/gitweb.cgi +++ b/gitweb.cgi @@ -22,10 +22,10 @@ my $rss_link = ""; # absolute fs-path which will be prepended to the project path #my $projectroot = "/pub/scm"; -my $projectroot = "/home/kay/public_html/pub/scm"; +my $projectroot = "/var/lib/git"; # location of the git-core binaries -my $gitbin = "/usr/bin"; +my $gitbin = "/usr/local/bin"; # location for temporary files needed for diffs my $git_temp = "/tmp/gitweb"; @@ -33,12 +33,25 @@ my $git_temp = "/tmp/gitweb"; # target of the home link on top of all pages my $home_link = $my_uri; +#css url for overall site + +my $site_css_url = "/style/site.css"; + +#page header and footer for all pages on this site + +my $site_header= $projectroot."/header.html"; +my $site_footer= $projectroot."/footer.html"; + # html text to include at home page -my $home_text = "indextext.html"; +my $home_text = $projectroot."/indextext.html"; # source of projects list -#my $projects_list = $projectroot; -my $projects_list = "index/index.aux"; +my $projects_list = $projectroot; +#my $projects_list = "index/index.aux"; + + + + # input validation and dispatch my $action = $cgi->param('a'); @@ -217,6 +230,12 @@ sub git_header_html { $title .= "/$action"; } } + + my $site_css = ""; + if (defined $site_css_url) { + $site_css=""; + } + print $cgi->header(-type=>'text/html', -charset => 'utf-8', -status=> $status, -expires => $expires); print < @@ -228,6 +247,7 @@ sub git_header_html { $title $rss_link +$site_css