Re: [Radiant] Atom Feeds
Sean Santry 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? feed xmlns=http://www.w3.org/2005/Atom; idtag:uniaraxa.edu.br,r:created format=%Y-%m-%d /:r:url //id titleUNIARAXÁ : r:title //title subtitler:content part=subtitle //subtitle updatedr:content part=updated //updated author nameUNIARAXÁ/name urihttp://www.uniaraxa.edu.br//uri /author link rel=self href=http://localhost:3000r:url / title=UNIARAXÁ : r:title / / link rel=alternate type=text/html href=http://localhost:3000r:content part=alternate / title=UNIARAXÁ : r:title / / generator uri=http://www.radiantcms.org; version=0.5.2Radiant CMS/generator rightCopyright 2002-2007, Centro Universitário do Planalto de Araxá/right r:content part=body / /feed Updated part: r:find url=/mediacenter/destaques/r:children:each limit=1 order=desc by=updated_atr: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 entry idtag:uniaraxa.edu.br,r:created format=%Y-%m-%d /:r:parentr:url //r:parentr:created format=%Y%m%d%H%M%S //id titler:title //title updatedr:updated format=%Y-%m-%dT%H:%M:%SZ //updated author namer:author //name /author link rel=alternate type=text/html href=http://localhost:3000r:url / / summaryr:content part=summary //summary /entry /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 parameter name=created_at / r:date parameter name=updated_at / r:date parameter name=published_at / it would be nice to have this by default :) Be Radiant! Gabriel Message: 1 Date: Mon, 05 Mar 2007 14:20:07 -0500 From: John W. Long [EMAIL PROTECTED] Subject: [Radiant] Atom Feeds To: radiant@lists.radiantcms.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1; format=flowed Has anyone used Radiant to produce Atom feeds? If so what code did you use? -- John Long http://wiseheartdesign.com ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Atom Feeds
Sean Santry 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 entry !-- snip . . . -- idhttp://seansantry.comr:url //id !-- snip . . .-- /entry /r:children:each /r:find - Sean ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Atom Feeds
Gabriel Lamounier wrote: r:date parameter name=created_at / r:date parameter name=updated_at / r:date parameter name=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 Long http://wiseheartdesign.com ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Atom Feeds
Has anyone used Radiant to produce Atom feeds? If so what code did you use? Long answer: http://seansantry.com/development/articles/2006/12/15/creating-an- atom-feed-in-radiant/ Short answer: ?xml version=1.0 encoding=UTF-8? feed xmlns=http://www.w3.org/2005/Atom; xml:lang=en-us title type=textSean Santry/title link rel=self href=http://seansantry.comr:url / / link rel=alternate type=text/html href=http:// seansantry.com/ / idhttp://seansantry.com//id generator uri=http://radiantcms.org/; version=0.5.2Radiant CMS/generator author nameSean Santry/name urihttp://seansantry.com//uri /author updatedr:find url=/articles/r:children:each limit=1 order=descr:date format=%Y-%m-%dT%H:%M:%SZ // r:children:each/r:find/updated r:find url=/articles/ r:children:each limit=10 order=desc entry authornamer:author //name/author publishedr:date format=%Y-%m-%dT%H:%M:%SZ //published updatedr:date format=%Y-%m-%dT%H:%M:%SZ //updated titler:title //title link rel=alternate type=text/html href=http:// seansantry.comr:url / / idhttp://seansantry.comr:url //id content type=htmlr:escape_htmlr:content // r:escape_html/content /entry /r:children:each /r:find /feed ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Atom Feeds
Sean Santry wrote: Has anyone used Radiant to produce Atom feeds? If so what code did you use? Long answer: http://seansantry.com/development/articles/2006/12/15/creating-an- atom-feed-in-radiant/ Thanks Sean. That's about what I worked out on my own. -- John Long http://wiseheartdesign.com ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Atom Feeds
Has anyone used Radiant to produce Atom feeds? If so what code did you use? I've got a Page type that exposes all the data needed for an atom feed. http://soxbox.no-ip.org/radiant/svn/extensions/x_groggy/app/models/atom_page.rb There's a few hard-coded things in there - Specifically in the 'atom' tag (choosing the pages to display) and atom:url tag (how do you get the full url of a page including host?) One thing to note is the updated_at (calculated in atom:each) - you can't have two pages with exactly the same updated time under atom (which is a weird restriction if you ask me) - I make sure to keep an eye on that and adjust if necessary (it bit me when I did an automated update from my old system). This is the actual content of the page. Note that you'd probably want to serve up your content escaped, but I'm fairly anal about maintaining valid content on my pages, so I didn't bother with that. ?xml version='1.0' encoding='UTF-8'? r:atom feed xmlns='http://www.w3.org/2005/Atom' xml:lang='en-us' xml:base='r:url/' titleThe Groggy Squirrel/title idhttp://www.thegroggysquirrel.com//id link href='./' / link rel='self' href='' / !-- logorsslogo.jpg/logo icon/favicon.ico/icon -- updatedr:feed_updated//updated authornameThe Groggy Squirrel/name/author subtitleThe Groggy Squirrel is an online guide to comedy in Melbourne and across Australia/subtitle rightsAll content copyright to their respective authors. All rights reserved./rights !-- generator uri='generator uri'generator description/generator -- r:each entry titler:title//title link href='r:url/' / idr:url//id authornamer:author//name/author publishedr:atom_published_date//published updatedr:atom_updated_date//updated content type='xhtml'div xmlns='http://www.w3.org/1999/xhtml' r:content/ /div/content/entry /r:each /feed /r:atom ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Atom Feeds
content type=htmlr:escape_htmlr:content // r:escape_html/content Your content tag should have mode=escaped if it's going to contain escaped html. Dan. ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant