threads / patch / 4852

patchgitweb: Include a site name in page titles

Subject: [PATCH] gitweb: Include a site name in page titles

## tl;dr

One message between Jul 11, 2006 and Jul 11, 2006. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Alp Toker· Jul 11, 2006, 20:10 UTC · lore
Tip Of The Day:
    <title>: the most important element of a quality Web page.

This helps users tell one 'git' bookmark apart from the other in their browser and improves the indexing of gitweb sites in Web search engines.

Defaults to the HTTP SERVER_NAME.
Signed-off-by: Alp Toker <alp@atoker.com>
---
 gitweb/gitweb.cgi |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
Show changes to gitweb/gitweb.cgi +6 −2
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 2e87de4..be0a01d 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -46,6 +46,10 @@ if (! -d $git_temp) {
 # target of the home link on top of all pages
 our $home_link = $my_uri;
 
+# name of your site or organization to appear in page titles
+# replace this with something more descriptive for clearer bookmarks
+our $site_name = $ENV{'SERVER_NAME'} || "Untitled";
+
 # html text to include at home page
 our $home_text = "indextext.html";
 
@@ -280,7 +284,7 @@ sub git_header_html {
 	my $status = shift || "200 OK";
 	my $expires = shift;
 
-	my $title = "git";
+	my $title = "$site_name git";
 	if (defined $project) {
 		$title .= " - $project";
 		if (defined $action) {
@@ -1760,7 +1764,7 @@ sub git_opml {
 	print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
 	      "<opml version=\"1.0\">\n".
 	      "<head>".
-	      "  <title>Git OPML Export</title>\n".
+	      "  <title>$site_name Git OPML Export</title>\n".
 	      "</head>\n".
 	      "<body>\n".
 	      "<outline text=\"git RSS feeds\">\n";
-- 
1.4.1.g97c7-dirty

← back to recent threads