git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] gitweb: make logo optional

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 4, 2011, 05:05 UTC
Message-ID
<20110104050555.GC8280@burratino>
In-Reply-To
<20110104050206.GA8280@burratino>
Date: Fri, 3 Sep 2010 19:45:09 -0500

Some sites may not want to have a logo at all. In particular, git instaweb can benefit from this.

While at it, use $cgi->img to simplify this code. (CGI.pm learned most HTML4 tags by version 2.79, so this should be portable to perl 5.8, though I haven't tested.)

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Eric liked an earlier version of this patch that did not use
$cgi->img.
 gitweb/gitweb.perl |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c65af1a..064697c 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3601,10 +3601,15 @@ EOF
 		insert_file($site_header);
 	}
 
-	print "<div class=\"page_header\">\n" .
-	      $cgi->a({-href => esc_url($logo_url),
-	               -title => $logo_label},
-	              qq(<img src=").esc_url($logo).qq(" width="72" height="27" alt="git" class="logo"/>));
+	print "<div class=\"page_header\">\n";
+	if (defined $logo) {
+		print $cgi->a({-href => esc_url($logo_url),
+		               -title => $logo_label},
+		              $cgi->img({-src => esc_url($logo),
+		                         -width => 72, -height => 27,
+		                         -alt => "git",
+		                         -class => "logo"}));
+	}
 	print $cgi->a({-href => esc_url($home_link)}, $home_link_str) . " / ";
 	if (defined $project) {
 		print $cgi->a({-href => href(action=>"summary")}, esc_html($project));
-- 
1.7.4.rc0
Previous: Junio C HamanoNext: Jakub Narebski
Message 5 of 8 in “gitweb: make logo optional”
  1. 0/2 gitweb: make logo optionalJonathan Nieder, Jan 4, 2011
  2. 1/2 gitweb: skip logo in atom feed when there is noneJonathan Nieder, Jan 4, 2011
  3. Jakub NarebskiJan 5, 2011
  4. Junio C HamanoJan 5, 2011
  5. 2/2 gitweb: make logo optionalJonathan Nieder, Jan 4, 2011
  6. Jakub NarebskiJan 4, 2011
  7. Jonathan NiederJan 4, 2011
  8. Eric WongJan 4, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.