RSS Feed

Hi,

I’'m a newbie in Rhythmyx and trying to figure out how to create a RSS feed for news content items of one of our sites. Do I need to create a template to generate the XML for the RSS feed? or is there a better way?

Thanks,

Yes, that’s how I plan to do it. Maybe like this:
</a>

<?xml version="1.0"?>
<rss version="2.0">
<--CHANNEL STUFF GOES HERE-->
    <item>
      <title>#displayfield("displaytitle")</title>
      <link>$pagelink</link>
      <description>#displayfield("callout")</description>
      <pubDate>#displayfield("sys_contentstartdate")</pubDate>
    </item>
<--ETC.-->

Right now, I’m more interested in going the other direction. I’d like an easy way to import RSS feeds into the Rhythmyx database.

The normal way to do this is to define a “page” template for the XML feed, and then a “snippet” template for each <item> node.

In the community marketing solution package, we add an extra layer of Dispatch templates to make this more generic (and to make it work across content types).

The CM Solution also contains an RSS importer.

Dave

Here’s my prototype template:

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<channel rdf:about="http://www.xml.com/cs/xml/query/q/19">
<title>#displayfield("displaytitle")</title>
<link>#displayfield("link")</link>
<description>#displayfield("teaser")</description>
<language>en-us</language>

<items>
<rdf:Seq>
#initslot("You24LinkforRSS" "site_path=//Sites/you24_magazine/get_trainer_advice/brandy_russel")
  #if($sys.currentslot.relresults.size() > 0)
     #foreach( $relresult in $sys.currentslot.relresults )
       $rx.doc.extractBody($relresult)
     #end
  #end			
</rdf:Seq>
</items>
</channel>

#initslot("You24FullLinkforRSS" "site_path=//Sites/you24_magazine/get_trainer_advice/brandy_russel")
  #if($sys.currentslot.relresults.size() > 0)
     #foreach( $relresult in $sys.currentslot.relresults )
       $rx.doc.extractBody($relresult)
     #end
  #end			


</rdf:RDF>

The slots are auto, and a small snippet creates the links. site_path is a variable in the auto slot query. I can supply more info if anybody is interested.

You can subscribe to it here:

http://you24.24hourfitness.com/get_trainer_advice/brandy_russel/trainer_advice.xml

Thanks! I will start working on this.

I got the RSS working, Now I’m trying to add the link to the RSS feed in the head section of all the pages so browsers can show the RSS icon. To do this, I added the following to the head section of my global template:

  #initslot("LinksForRSS" "site_path=$site_path&template=sn_AnnouncementRSSHeadLink"  )
  #if($sys.currentslot.relresults.size() &gt; 0)
     #foreach( $relresult in $sys.currentslot.relresults )
       $rx.doc.extractBody($relresult)
     #end
  #end	

The “LinksForRSS” slot, is a active assembly that uses the “sys_AutoSlotContentFinder” to query for my RSS content types. And I have the “sn_AnnouncementRSSHeadLink” template to generate the actual link. In the bindings of this tempalte I have the $pagelink which has a value of:

$rx.location.generate($sys.assemblyItem, “pg_AnnouncementsRSS” )

This will work fine for all the pages that have the same path as my RSS file, but other pages that have a different path this will generate a link to the RSS file using the wrong path.

How can I fix this? or is there an easier way to do this?

thanks,

The normal we do this is by creating a Slot on the NavTree (or some Navon, if there is an RSS feed for each site section). This slot contains the RSS “item”.

Assembling this slot (with #nodeslot) will give you links to the RSS items no matter what folder you start in.