From: Tony Finch Date: Thu, 4 Jul 2013 17:02:12 +0000 (+0100) Subject: gitweb: allow extra breadcrumbs to prefix the trail X-Git-Url: https://git.ladys.computer/Gitweb/commitdiff_plain/85c71c35a86d21bd3c93ab46bf8f4f117d5c8a780eb5a09de1d9fa7aa974345d?ds=sidebyside;hp=b898bb9a0cf6c421680fba4ee743ea387d09e06ebb3f944f53aeeb451785d9e7 gitweb: allow extra breadcrumbs to prefix the trail There are often parent pages logically above the gitweb projects list, e.g. home pages of the organization and department that host the gitweb server. This change allows you to include links to those pages in gitweb's breadcrumb trail. Signed-off-by: Tony Finch Reviewed-by: Jonathan Nieder Acked-by: Jakub Narebski Signed-off-by: Junio C Hamano --- diff --git a/gitweb.perl b/gitweb.perl index 412ef12..a1138c1 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -85,6 +85,9 @@ our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++"; # string of the home link on top of all pages our $home_link_str = "++GITWEB_HOME_LINK_STR++"; +# extra breadcrumbs preceding the home link +our @extra_breadcrumbs = (); + # name of your site or organization to appear in page titles # replace this with something more descriptive for clearer bookmarks our $site_name = "++GITWEB_SITENAME++" @@ -3983,7 +3986,9 @@ sub print_nav_breadcrumbs_path { sub print_nav_breadcrumbs { my %opts = @_; - print $cgi->a({-href => esc_url($home_link)}, $home_link_str) . " / "; + for my $crumb (@extra_breadcrumbs, [ $home_link_str => $home_link ]) { + print $cgi->a({-href => esc_url($crumb->[1])}, $crumb->[0]) . " / "; + } if (defined $project) { my @dirname = split '/', $project; my $projectbasename = pop @dirname;