My BlogCFC mods for Windows Live Writer

Posted by Dan on Sep 24, 2008 @ 10:56 AM

When I re-launched my blog last year I mentioned that I made several changes to the XML-RPC code in order to make blogging from Windows Live Writer simpler. I didn't release the XML-RPC mods at the time, because I wanted to make sure they were nice and stable. Now that I've been using the mods for almost a year, I think their stable enough to share.

The changes I made most involved trying to simplify blog posting. My key objective was to try and avoid having to drop down to the "source code" mode altogether, but still be able to use the custom tags that BlogCFC supports such as the <more/>,  <code> and <textblock> tags.

To solve this problem I build some parsing functions which look at the incoming HTML and look for these special tags written in escaped HTML. When it finds these tags, it then converts the escaped HTML into their unescaped format. This allows me to just cut-n-paste or type in my <code> blocks directly into Windows Live Writer and never have to go into "View Source" code. This means I can use the "Normal" (Design View) and just type into Live Writer:

<code>

<h1>Hello World!</h1>

</code>

To produce:

<h1>Hello World!</h1>

I can also just type in the <more/> tag into Live Writer in the place where I want to split text into two.

You may be wondering how I'm able to use the type in these special tags without the parsing functions picking them up. Since I knew I may want to actually blog these tags at some time, I build in some escape characters you can use to avoid processing and have the tags displayed correctly. In order to display one of the special tags, just write the tags with brackets (i.e. "[" and "]") just inside the < and > characters, for example: <[specialTag]>. This only works with the <code>, <more/> and <textblock> tags.

I have not tested this code with that latest BlogCFC code, but this should work with BlogCFC v5.9 (released Oct 12, 2007.) Either way, before implementing I recommend making a backup of your "xmlrpc" folder and even doing a diff on the folders to compare the changes.

The one change you'll need to make to your Live Writer setup, is you must add the query string "?parseMarkup=true" to your XML-RPC URL in order for BlogCFC to use the parsing functions. I did this to make it easy to toggle this functionality on or off on a per blog basis.

If you download my XML-RPC mods and use them, let me know how they work out for you! Perhaps if the mods are well received, I'll tidy them up even more to see if Raymond Camden wants to include them in the official release.

Categories: HTML/ColdFusion

11 Comments

  • What's your experience with making BlogCFC Windows Live Writer compatible?

    I want to make a new project in CF that is Windows Live Writer compatible, but I'm not sure whether to go for RSD (Really Simple Discoverability), the Metaweblog API, or the Movable Type API that Live Writer supports.

    I asked @ Live Writer group here:
    http://groups.msn.com/windowslivewriter/generaltop...

    but the reply is very short and not detailed enough to help me make the decision.
  • @Henry:

    All I did was mod this code (which uses the Metaweblog API) to add the functionality I wanted. However, if you look through the code in the zip you'll see what's needed to interact with the Metaweblog API.
  • I was using Live Writer with Blogcfc for a while, and totally loved it.

    Unfortunately, somewhere the combination corrupts all Japanese and Chinese text, and seems to overwrite images. I got tired of finding old blog posts with new images, so I went back to the admin interface. I blog a lot less now :(

    -Rob
  • Dan, I'm using your modded xmlrpc because the thing that bugged me the most about live writer, was not being able to use <code></code> blocks and the <more/> tag that come with blogcfc.

    So, until I'd read your post I'd given up on live writer. So I re-downloaded it this morning, and installed it along with your xmlrpc mods. Your mods seem to work alright so far, my problem is with live writer again, and I don't know if you've run across this before.

    I can post a new entry to my blog just fine, but if I then go to make a change to the entry and re-publish, it says that it gets a 500 response from the server. Specifically,

    The server reported an error with the following URL:

    http://www.cjordan.us/xmlrpc/xmlrpc.cfm?parseMarku...

    500 Internal Server Error

    Any idea what's going on there?

    Thanks heaps,
    Chris
  • @Chris:

    Upgrade to the latest version of BlogCFC. My mods are integrated with the latest version and I also fixed the 500 issue (I implemented a number of changes to BlogCFC a few months back.)
  • Dan, according to RiaForge, the latest version is 5.9.4.001. Is that the one I need to get? Will that be sufficient? Also, if I get that will the modded xmlrcp that I downloaded from your blog earlier this morning be sufficient too?

    Thanks for the hard work! :o)
  • @Chris:

    The latest version of the BlogCFC *includes* my mods (amongst other fixes,) so there's no need for this mod.
  • Sweetness! Thanks Dan! :o)
  • Dan, I'm still getting the 500 internal server error using Live Writer 2009. Do I still need to add the ?parseMarkup=true in the latest version of blogcfc (5.9.4.001)?
  • @Chris:

    Yes, you still need to use the parseMarkup=true. Make sure you're using the "Metaweblog API" provider. Also, in the "Advanced" settings, I'm using "Western European (Windows): Windows-1252" for the character set and "XHTML" as the markup type.

    If you're still having problems, I recommend using an HTTP proxy like Fiddler or Charles to see what's actually happening with the packets.
  • Dan, I've made those changes, but still I get the error. The weird part is that despite getting the error, my post actually makes it to my blog just fine. I only have to refresh my blog cache for it to show up. I've blogged about this problem (http://cjordan.us/index.cfm/2009/9/18/Windows-Live...), but I'll have to try what you said about Fiddler or Charles.

Comments for this entry have been disabled.