From c5d457c20c4ac43b877221b23ad6b2dbdf3b6d75 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 28 Aug 2014 02:14:47 +0000 Subject: feed: show permalink to home page This will make it easier to bookmark an index page with threading context. --- lib/PublicInbox/Feed.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index cf64517b..1eaba6c2 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -59,7 +59,7 @@ sub generate_html_index { my @messages; my $git = PublicInbox::GitCatFile->new($args->{git_dir}); - my $last = each_recent_blob($args, sub { + my ($first, $last) = each_recent_blob($args, sub { my $mime = do_cat_mail($git, $_[0]) or return 0; my $t = eval { str2time($mime->header('Date')) }; @@ -89,7 +89,7 @@ sub generate_html_index { Email::Address->purge_cache; - my $footer = nav_footer($args->{cgi}, $last, $feed_opts); + my $footer = nav_footer($args->{cgi}, $first, $last, $feed_opts); my $list_footer = $args->{footer}; $footer .= "\n" . $list_footer if ($footer && $list_footer); $footer = "
" . PRE_WRAP . "$footer" if $footer; @@ -99,21 +99,22 @@ sub generate_html_index { # private subs sub nav_footer { - my ($cgi, $last, $feed_opts) = @_; + my ($cgi, $first, $last, $feed_opts) = @_; $cgi or return ''; my $old_r = $cgi->param('r'); my $head = ' '; my $next = ' '; if ($last) { - $next = qq!next!; + $next = qq!next!; } if ($old_r) { $head = $cgi->path_info; - $head = qq!head!; + $head = qq!head!; } - my $atom = "{atomurl}\">atom"; - "$next $head $atom"; + my $atom = "{atomurl}\">atom"; + my $permalink = "permalink"; + "$next $head $atom $permalink"; } sub each_recent_blob { @@ -174,7 +175,7 @@ sub each_recent_blob { close $log; # we may EPIPE here # for pagination - $commits[-1]; + ($commits[0], $commits[-1]); } # private functions below -- cgit v1.2.3-24-ge0c7