From 9d39eb9bd16f3f2d81785b14e94f10e105f497d7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 4 Oct 2015 00:13:47 +0000 Subject: view: add links for mbox and atom feeds in homepage Having per-thread Atom feeds and downloadable mboxen is powerful and should be more easily visible/accessible to casual readers. --- lib/PublicInbox/View.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index c9be7700..beb99895 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -12,6 +12,7 @@ use PublicInbox::Hval; use PublicInbox::MID qw/mid_clean id_compress mid2path/; use Digest::SHA qw/sha1_hex/; my $SALT = rand; +my $MBOX_TITLE = 'title="download thread as gzipped mbox"'; require POSIX; # TODO: make these constants tunable @@ -198,7 +199,8 @@ sub emit_thread_html { my $next = ""; $next .= $final_anchor == 1 ? 'only message in' : 'end of'; $next .= " thread, back to index"; - $next .= "\ndownload thread: mbox.gz"; + $next .= "\ndownload thread: "; + $next .= "mbox.gz"; $next .= " / follow: Atom feed"; $cb->write("
" . PRE_WRAP . $next . "\n\n". $foot . ""); @@ -862,17 +864,21 @@ sub dump_topics { $ts = POSIX::strftime('%Y-%m-%d %H:%M', gmtime($ts)); if ($n == 1) { $attr = "created by $u @ $ts UTC"; - $n = "\n"; + $n = ""; } else { # $n isn't the total number of posts on the topic, # just the number of posts in the current results # window, so leave it unlabeled $attr = "updated by $u @ $ts UTC"; - $n = " ($n)\n"; + $n = " ($n)"; } if ($level == 0 || $attr ne $prev_attr) { + my $mbox = qq(mbox.gz); + my $atom = qq(Atom); $pfx .= INDENT if $level > 0; $dst .= "$pfx- ". $attr . $n; + $dst .= " - $mbox / $atom\n"; $prev_attr = $attr; } } -- cgit v1.2.3-24-ge0c7