# Re: Atom Feeds

**URL:** <https://www.ruby-forum.com/t/re-atom-feeds/88062>\
**Category:** Radiant CMS\
**Created:** [March 7, 2007, 9:13pm UTC](https://www.ruby-forum.com/t/re-atom-feeds/88062 "2007-03-07T21:13:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![poopsmith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a87d85/32.png) [@poopsmith](https://www.ruby-forum.com/u/poopsmith)\
**Post date:** [March 7, 2007, 9:13pm UTC](https://www.ruby-forum.com/t/re-atom-feeds/88062/1 "2007-03-07T21:13:53Z")

</div>

Sean S. technique  
([http://seansantry.com/development/articles/2006/12/15creating-an-atom-feed-in-radiant/](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](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 🙂

Be Radiant!  
Gabriel

---

<div class="post-metadata">

**Author:** ![poopsmith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a87d85/32.png) [@poopsmith](https://www.ruby-forum.com/u/poopsmith)\
**Post date:** [March 7, 2007, 10:04pm UTC](https://www.ruby-forum.com/t/re-atom-feeds/88062/2 "2007-03-07T22:04:00Z")

</div>

> Sean S. technique  
> ([http://seansantry.com/development/articles/2006/12/15creating-an-](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

---

<div class="post-metadata">

**Author:** ![poopsmith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a87d85/32.png) [@poopsmith](https://www.ruby-forum.com/u/poopsmith)\
**Post date:** [March 7, 2007, 11:14pm UTC](https://www.ruby-forum.com/t/re-atom-feeds/88062/3 "2007-03-07T23:14:17Z")

</div>

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](http://wiseheartdesign.com)
