MicroCMS + Live Writer

Posted at 11:10 p.m. on 16/12/2008 by Daniel

An idea sprung on me last night – Why not let people update their websites uses Live Writer (or one of the other blogging tools)? They produce rather good HTML and are easy to pickup.

I have based it on the Metablog API that most blogging tools use, and have used the XML-RPC library to take care of the nasty parsing for me.

So I decided to build the functionality into MicroCMS, here’s how to make it work.

Step 1:

Checkout the latest source code from

https://svn.kustompage.com:8080/svn/microcms/trunk (username: guest)

If you don’t already have a website running MicroCMS, it will be easy to get started – just use the sample project provided. If you do have a website and you haven’t made any changes to the core, just copy the core project to your website. If you have made changes, sorry, but you’re gonna have to do a manual merge.

All references are in the lib folder (you might need to manually update the reference to the XML-RPC library).

If you are using the sample project, Metablog is already setup, so skip to the end to see how to setup Live Writer.

Step 2:

Ok, so you should be done copying or merging the core project, and it should fully build.

On your websites front end, create a Settings.xml file in your App_Data folder, and add the following xml:

[code=xml]<?xml version="1.0" encoding="utf-8"?>
<settings>   <setting name="API.Enabled" value="true" />
  <setting name="API.ImagePath" value="C:\Documents and Settings\Daniel\Desktop\MicroCMS\MicroCMS\img\" />
  <setting name="API.ImageURL" value="/img/" />   <setting name="API.FilePath" value="C:\Documents and Settings\Daniel\Desktop\MicroCMS\MicroCMS\files\" />
  <setting name="API.FileURL" value="/files/" />
  <setting name="API.Username" value="user" />
  <setting name="API.Password" value="password" />
</settings>[/code]

Step 3:

In your websites root directory (you can place it anywhere, I’m just trying to keep things simple) create a new Generic Handler called APIInterface.ashx.

Right click on your new file (in Visual Studio) and press View Markup. Replace the first line with this:

[code=aspnet]<%@ WebHandler Language="C#"  Class="MicroCMS.Core.MetaWebBlogAPI.Interface" %>[/code]

Check that you can browse to that page. It should produce a web service like page that shows you the methods that your client can use.

Done! Now to setup Live Writer

Step 4:

Install Live Writer if you don’t already have it (You could also use any client that supports the MetaBlog API, but I have only tested in Live Writer) – get it from http://get.live.com/writer/overview

Once you have Live Writer open, start the Add Web Blog wizard (Webblog – Add Web Blog)

Step 5:

Choose Another webblog service and press next.

Enter your website details. They will look something like this:

Website Homepage URL: http://yourdomain.com/
Username: your username
Password: your password

Hit next.

Choose MetaWebBlog API from the dropdown box and enter

http://yourdomain.com/APIInterface.ashx

into the Remote Posting URL textbox.

Click next a few times till you get to the end, and wow, it’s done!

What it does:

You can create pages just as easily as creating blog posts – enter a title and content, add images and file links – and it will all be saved back to your website.

If you want to open existing pages, simply open them up like you would an existing blog post.

You can’t yet delete pages using Live Writer. But that will be coming soon.

The End

So I think that’s about everything, have got it running on a few sites and it appears to work. If anyone’s brave enough to give it a shot, let me know, I’m interested to see how it goes (and if I've missed any steps)


Post Comment
Name
Email Address
Website (Optional)
Comment
- Your comment will be moderated before it shows up.