Wednesday, May 21, 2008

Using Live Writer to Post Content to a Web Site

I've just added the MetaWeblog API to the Content Management System (CMS) of Suteki Shop. It's most excellent. It means that an administrator can manage the content of the web site using a slick WSYWIG tool like Windows Live Writer. I simply ripped the code for the API from Subtext, a really nice open source blogging application. It took me most of today to get it working, but it'll be a major win for my users who I can't expect to write HTML straight into a web based admin interface.

It's really easy to set up. Simply open up Live Writer and add a new account saying you want to use 'Another weblog service':


Then enter the URL of the application, here I'm just giving it the URL of the Visual Studio Development Web Server. You also need to enter an admin username (email) and password.


The last step is to tell Live Writer that Suteki Shop uses the Metaweblog API and point it to the XmlRpc endpoint that hosts the API.


After that it's all set up and you can write a post, including images in live writer:


When you click the 'Publish' button the content magically appears with a new menu item on the Suteki Shop site:


You can find my subtext's implementation of the MetaWeblog API the usual place:

The MetaWeblog API is implemented in the files:



Note the additional handler in the web.config file:

<add type="Suteki.Shop.XmlRpc.MetaWeblog, Suteki.Shop" path="metablogapi.aspx" verb="*" />


preet sangha said...

Excellent work Mike! I was trying to get live writer working with mediawiki (e.g. wikipedia) and frankly ran out of steam on morning at 3am over xmas hols!

Well done - and keep writing.

Mike Hadlow said...

Thanks Preet! It was really straight forward, mainly because of the excellent SubText implementation of the MetaWeblog API. I lifted most of the code and just replaced their internal hookup to their blogging engine with my content object model.

Does Live Writer support the mediawiki API?


Anonymous said...

Hi Mike,

Can we use your instructions to use windows live writer to post to mediawiki as well (hosted on IIS7)

If this is possible can you please guide me

Thanks and Regards

Mike Hadlow said...

Hi Anonymous,

I haven't tried using the same technique to post to mediawiki, but if it's using a well known blogging API, then it should be pretty easy.

Am I going to do your work for you? Well, get in touch by email and we can discuss my consultancy rates :)

preet sangha said...

hi there me again :-) We've just doing this formally (project is at POC stage we started last week). To answer your anon commentator - no Mediwiki doesn't have standard blogging (live writer compatible) interface. We're doing this by using a local WCF proxy svc that provides mediwiki articles via the Atom Publishing Protocol.