Dave Johnson on open web technologies, social software and software development
« Roller 0.9.7 is... | Main | Lance's OPML macro. »
Dave Winer's Outline Processor Markup Language (OPML) is the weblogging world's format of choice for exchanging RSS feed information, bookmarks, and, of course, outlines. Roller doesn't store information in OPML format, but Roller can import bookmarks in OPML format and with some minor customizations Roller can also produce OPML output for bookmarks and other data.
Producing OPML output of your Roller bookmarks is easy. Here is how you'd do it in Roller 0.9.7. Just login to your Roller account, go to the Website:Pages page and add a new page. I called my page _BookmarksOPML, because names that start with an underbar are not displayed in the Roller Nav Bar (on my page the NavBar is shown under the word NAVIGATION on the right side of my page). Next, I entered the following Velocity template code for the page:
<opml version="1.1"> <head><title>Dave's bookmarks</title></head> <body> <outline text="Blogroll"> #set( $links = $vHelper.getFolder("Blogroll").getBookmarks() ) #foreach( $link in $links ) <outline text="$link.name" link="$link.url" /> #end #set( $links = $vHelper.getFolder("Java blogs").getBookmarks() ) #foreach( $link in $links ) <outline text="$link.name" link="$link.url" /> #end </outline> </body> </opml>
There is only one real trick here: the use of the $vHelper object. That object is placed into the Velocity context to allow you access to Java objects that represent your weblog entries, bookmarks, etc. To see what methods are available on the $vHelper object see the Javadocs for VelocityHelper. Most Roller users would never need to use $vHelper. Their needs should be completely satisfied by the ordinary Roller VelociMacros. For those who want to add new macros, however, $vHelper is a necessity.
In the code above, I use $vHelper to fetch two of my bookmark folders, "Blogroll" and "Java blogs". A bookmark folder is also a Java object (FolderData). From a Bookmark Folder, I can fetch bookmark objects (BookmarkData). I use a Velocity #foreach to iterate through the bookmarks in each folder and to spit out the bookmark names and URLs in OPML format.
So, does it work? Sure. The URL is below if you want to try it yourself.
http://www.rollerweblogger.org/page/roller/BookmarksOPML
Here is what my new OPML page looks like in Philip Pearson's recently Script-dotted C# OPML browser:
UPDATE: I just noticed that Dave Winer posted a UserTalk script (UserTalk is Radio's own scripting language) this morning that does roughly the same thing that I did above. His script is a lot more complicated because it is doing a lot more work: filling in the headers, checking for escapes, etc.
Dave Johnson in Roller
08:51AM Apr 19, 2003
Comments [1]
Tags:
Roller
This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog
Below are the most recent entries in the category Roller, some may be related to this entry.
Posted by Vanity Foul on April 20, 2003 at 03:24 PM EDT #