mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-08-10 01:53 am

[dw-free] make RSS feeds for specific tags more discoverable

[commit: http://hg.dwscoalition.org/dw-free/rev/4060651ad41a]

http://bugs.dwscoalition.org/show_bug.cgi?id=1560

Add 'add this RSS feed filtered by tags' link for discoverability by RSS
readers/browsers/etc.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/S2.pm
--------------------------------------------------------------------------------
diff -r c90b294a40e7 -r 4060651ad41a cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Sun Aug 09 17:43:37 2009 +0000
+++ b/cgi-bin/LJ/S2.pm	Mon Aug 10 01:53:23 2009 +0000
@@ -2042,8 +2042,13 @@ sub Page
 
     # Automatic Discovery of RSS/Atom
     if ($opts && $opts->{'addfeeds'}) {
-        $p->{'head_content'} .= qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$p->{'base_url'}/data/rss" />\n};
-        $p->{'head_content'} .= qq{<link rel="alternate" type="application/atom+xml" title="Atom" href="$p->{'base_url'}/data/atom" />\n};
+        if ( $opts->{'tags'} ) {
+            my $taglist = join( ',', map( { LJ::eurl($_) } @{$opts->{tags}} ) );
+            $p->{'head_content'} .= qq{<link rel="alternate" type="application/rss+xml" title="RSS: filtered by selected tags" href="$p->{'base_url'}/data/rss?tag=$taglist" />\n};
+            $p->{'head_content'} .= qq{<link rel="alternate" type="application/atom+xml" title="Atom: filtered by selected tags" href="$p->{'base_url'}/data/atom?tag=$taglist" />\n};
+        }
+        $p->{'head_content'} .= qq{<link rel="alternate" type="application/rss+xml" title="RSS: all entries" href="$p->{'base_url'}/data/rss" />\n};
+        $p->{'head_content'} .= qq{<link rel="alternate" type="application/atom+xml" title="Atom: all entries" href="$p->{'base_url'}/data/atom" />\n};
         $p->{'head_content'} .= qq{<link rel="service.feed" type="application/atom+xml" title="AtomAPI-enabled feed" href="$LJ::SITEROOT/interface/atomapi/$u->{'user'}/feed" />\n};
         $p->{'head_content'} .= qq{<link rel="service.post" type="application/atom+xml" title="Create a new post" href="$LJ::SITEROOT/interface/atomapi/$u->{'user'}/post" />\n};
     }
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org