Re: Atom Feeds

Sean S. technique
(http://seansantry.com/development/articles/2006/12/15creating-an-atom-feed-in-radiant/)
is fine, but not quite right.

#1 - It uses the <r:date> tag for the updated field, but this tag only
displays the published_at date.
#2 - It uses the same id for every post, but the atom spec asks for a
unique id for each one.

I based my code on Sean’s, but with the proper corrections:

Layout:

<?xml version="1.0" encoding="utf-8"?> tag:uniaraxa.edu.br,: UNIARAXÁ : UNIARAXÁ http://www.uniaraxa.edu.br/ " title="UNIARAXÁ : " /> Radiant CMS Copyright 2002-2007, Centro Universitário do Planalto de Araxá

Updated part:

<r:find url="/mediacenter/destaques/"><r:children:each limit=“1”
order=“desc” by=“updated_at”><r:updated format="%Y-%m-%dT%H:%M:%SZ"
/></r:children:each></r:find>

Body part:

<r:find url="/mediacenter/destaques/">
<r:children:each limit=“10” order=“desc” by=“published_at”>

tag:uniaraxa.edu.br,<r:created format="%Y-%m-%d"
/>:<r:parent><r:url /></r:parent><r:created format="%Y%m%d%H%M%S"
/>
<r:title />
<r:updated format="%Y-%m-%dT%H:%M:%SZ" />

<r:author />


<r:content part=“summary” />

</r:children:each>
</r:find>

This is not production code, just a quick test.

To solve problem #1 I created the <r:updated> tag, to show the date
and time the entry was updated, not published.

To solve problem #2 I followed the dive into mark tutorial
(http://diveintomark.org/archives/2004/05/28/howto-atom-id) and
created another tag <r:created>

The layout + page parts serves me best, because I have many different
feeds.

Last words:
The <r:updated> and <r:created> tags are just modified copies of the
<r:date> tag (quick test, remember?) so, it’s not the way to go. The
best aproach is to modify the <r:date> tag to accept another
paramenter to specify the date we want, for example:
<r:date =“created_at” />
<r:date =“updated_at” />
<r:date =“published_at” />

it would be nice to have this by default :slight_smile:

Be Radiant!
Gabriel

Sean S. technique
(http://seansantry.com/development/articles/2006/12/15creating-an-
atom-feed-in-radiant/)
is fine, but not quite right.

#1 - It uses the <r:date> tag for the updated field, but this tag only
displays the published_at date.

Agreed, this is a limitation. I just never got around to creating a
patch to add an updated_at tag.

#2 - It uses the same id for every post, but the atom spec asks for a
unique id for each one.

Hmmm, I’m not sure why you say that. Each post uses its URL for its
ID, and that’s guaranteed to be unique:

<r:find url="/articles/">
<r:children:each limit=“10” order=“desc”>

   <id>http://seansantry.com<r:url /></id>
 </entry>

</r:children:each>
</r:find>

  • Sean

Gabriel L. wrote:

<r:date =“created_at” />
<r:date =“updated_at” />
<r:date =“published_at” />

I like it. How about this format:

<r:date for=“updated_at” format=“foobar” />

I’ll accept a unit tested patch for this. By default the for attribute
should be set to “published_at” so that if it’s not specified the tag
refers to the published date (unless of course the page has not be
published, in that case it should refer to “updated_at”).


John L.
http://wiseheartdesign.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs