Ruby Forum Radiant CMS > How do I create a feed for my Radiant site?

Posted by Mohit Sindhwani (Guest)
on 31.10.2007 10:48
(Received via mailing list)
I think the subject says it all.

I'm just wondering how to create feeds from my Radiant powered site.

In Firefox, I notice the 'RSS' button in the location bar when I go to
the site.  It redirects to the page example.com/rss/ - do I just create
something under the home page of the site called 'rss' and then look for
ways to add content into it (like iterating from the top of the site,
excluding no_menu pages and adding some information about each of the
children pages) - is that it?

How about different feeds?  I must admit that I'm a little unclear on
how feeds are generally provided, let alone feeds under Radiant.  In
return for the help, I promise that I'll write it up on my blag and add
it to the documentation for Radiant.

thanks,
Mohit.
Posted by Andrew Neil (Guest)
on 31.10.2007 11:31
(Received via mailing list)
> I must admit that I'm a little unclear on how feeds are generally  
> provided

This should help
http://www.w3schools.com/rss/rss_intro.asp

> In Firefox, I notice the 'RSS' button in the location bar when I go to
> the site.

If you are seeing the RSS button in firefox, then your site probably
already has an RSS feed. This is included in a default radiant site.
So log in to the admin area of your site and look for a page called
'RSS feed', or something similar. It should contain something like this:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
   <channel>
     <title>Article RSS Feed</title>
     <link>http://your-web-site.com<r:url /></link>
     <language>en-us</language>
     <ttl>40</ttl>
     <description>The main blog feed for my Web site.</description>
     <r:find url="/articles/">
     <r:children:each limit="10" order="desc">
         <item>
           <title><r:title /></title>
           <description><r:escape_html><r:content /></r:escape_html></
description>
           <pubDate><r:rfc1123_date /></pubDate>
           <guid>http://your-web-site.com<r:url /></guid>
           <link>http://your-web-site.com<r:url /></link>
         </item>
     </r:children:each>
     </r:find>
   </channel>
</rss>


I would suggest replacing: http://your-web-site.com (which appears 3
times in the above) with <r:snippet name="domain"/>, and creating a
snippet called domain with your domain name in it. You could have
localhost:3000 in your development environment, and the actual domain
name in the production environment.

The other tag that I would draw your attention to is this one:

     <r:find url="/articles/">

That will find all children of the page 'articles'. You can
substitute /articles/ for /features/ or /news/ or whatever it is that
you want to syndicate, but you can only collect the children of a
single page. If you want the RSS feed to collect children from a
range of different pages, you will need to install the aggregation
extension. With this, you can replace the <r:find> tag with:

    <r:aggregate urls="/articles/; /news/; /features/" >
  ...
    </r:aggregate>

Everything that was previously inside the <r:find> block can be
copied into the <r:aggregate> block.

That should get you started.

Drew
Posted by Mohit Sindhwani (Guest)
on 31.10.2007 17:01
(Received via mailing list)
Andrew Neil wrote:

--lots of useful stuff snipped--
> That should get you started.
>
> Drew


Andrew,

Thanks very much!  I shall get started with this and return when I'm
more (or less confused).

Cheers,
Mohit.
10/31/2007 | 11:59 PM.