Steve Lacey. Get yours at flagrantdisregard.com/flickr

Automatic OPML feed

| | Comments (12) | TrackBacks (2)

Scoble is looking for a blogging platform that automatically produces an OPML feed based on tagged data.

Well, I just knocked this index template up for MovableType which seems to do the job. It loads fine in Dave's OPML editor too:

<?xml version="1.0" encoding="<$MTPublishCharset$>"?>
<opml version="1.0">
<head>
  <title><$MTBlogName$></title>
  <dateCreated><$MTDate format_name="rfc822"$></dateCreated>
</head>
<body>
<MTCategories>
<outline text="<$MTCategoryLabel$>">
  <MTEntries>
  <outline type="link"
           text="<$MTEntryTitle 
               remove_html="1"
               encode_xml="1"$>"
           url="<$MTEntryPermalink$>" 
           created="<$MTEntryDate format_name="rfc822"$>" />
  </MTEntries>
</outline>
</MTCategories>
</body>
</opml>

Just add it as an index template, and you're golden. This is working in my install of MovableType 3.2 - I expect it will work fine with TypePad.

The autogenerated opml for my blog is now appearing over here.

2 TrackBacks

Listed below are links to blogs that reference this entry: Automatic OPML feed.

TrackBack URL for this entry: http://www.steve-lacey.com/cgi-bin/mt/mt-bar.cgi/579

» OPML Feed Template per Movable Type from Simone Carletti's Weblog

Un template per creare un feed in OPML attraverso Movable Type. Read More

» OPML Feed Template per Movable Type from Simone Carletti's Weblog

Un template per creare un feed in OPML attraverso Movable Type. Read More

12 Comments

Thanks for making this available Steve. Unfotunately though I can't get it working in Typepad - I'm getting this error message -

"TypePad has encountered an error. The requested page could not be found or the requested action could not be completed."

Well I've submitted a trouble ticket so hopefully I've have an answer soon.

And here's the answer I got back -

"Not all tags from Movable Type will work within TypePad the same way. The way that the MTDate tag is used here does not appear to be compatible with TypePad, which is why you're getting an error."


No advice on how to get around it either:(

And I'm not much of a code so I'm stumped :(

Steve said:

Errk. I can't see what typepad would have an error with, it's a standard MT3.2 tag. Unfortunately I can't find any typepad specific tag documentation on their site...

Well now I'm more confused that error. I asked them to suggest how I might get around the problem and they could only point me to this documentation -

http://help.typepad.com/tags/

But if you click on the page for the Calendar Tag Index from there you will see that $MTDate is used in the example code though NOT specified in the tag list below. Huh? Is it obvious yet that I'm no programmer? ;-)

Aha! Eureka! The penny drops! Duh!

So it wasn't the Date tag which was incorrect but the date format. I replace your formatting Steve with this -

$MTDate format="%B %Y"$

Not that I really understand it but at least its working now and producing valid (I assume) OPML which I can open in Dave Winer's OPML Editor.

Thank you again for showing us how - this is brilliant!

-Jim.

Sorry for being a comment hog Steve but I just have to add a warning for anyone who's thinking of doing this for TypePad that there still appears to be a slight problem.

Running your (Steve's) OPML file through KBCafe's OPML Surfer works fine but running mine through it just produces raw OPML, so apparently there's some kind of problems still with the formatting? :(

Having said that, my OPML does import fine in Dave Winer's OPML editor and it displays perfectly in Taskable so perhaps the OPML surfer is just a little too unforgiving? Hmmm....

Steve said:

James: It might be because you don't have an encoding set. Perhaps typepad doesn't support the MTPublishCharset tag?

If so, just manually put encoding="utf8" in the first line...

Does that help?

That was it Steve, problem solved! Thank you very much once again.

Hello Steve,
I suggest to change the line
<outline text="<$MTCategoryLabel$>">
to
<outline text="<$MTCategoryLabel encode_xml="1" $>">

In this way labels like "You & Me" (please note the &) will be correctly encoded in the feed.

Steve, any idea how I could output a separate OPML file for each category? I know it might sound silly, initially, to do so as the whole point of an OPML file is the hierarchy. However, what I'd like to do is transclude/include in a "Football" hierarchy only the posts categorised under "Football" by a *group* of different bloggers.

I tried -

<MTCategories category="Football">

and

<MTEntries category="Football">

but neither of them worked. The latter has worked for me previously when creating separate RSS and WAP feeds on a per category basis so I'm a little confused.... once again ;-)


Steve said:

James. The MTEntries idea should work. You'll probably need to remove the outer MTCategories tag though.

Steve said:

Simone: Yup, that's a good idea.

Leave a comment

About Me

Steve Lacey, software developer at Facebook, British, married to the lurvely Nabila, dad to the wonderful Julian and Jasmine. Living in Kirkland (near Seattle), WA.


A brief professional bio.


steve@steve-lacey.com
+1 (425) 214-4716

About this Entry

This page contains a single entry by Steve published on September 29, 2005 9:40 PM.

Back to work was the previous entry in this blog.

Now that is a Flight Simulator for the home is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Statsorama

  • 1050 posts
  • 1333 comments

Music