Subtext articles

Notes on the move to WordPress  

The change to WordPress from Subtext went without major hitch. This was great considering I was tweaking the design and articles right up to going on holiday (I wouldn’t do this in a professional environment but my blog is a sandpit for such dare-devil risk taking ;-)

Here are my notes on the experience.

Spam

Akismet is good but I prefer the invisible captcha that Subtext was using. I’ve gone from dealing with 1 rogue spam a month to 1-2 held for moderation a day.

View counts

The WordPress import format doesn’t deal with view counts. I wrote a query against Subtext to list them, a query in MySQL to identify article numbers then manually executed

UPDATE post_meta SET meta_value = meta_value + 123 WHERE meta_key = 'views' AND article_id = 456

For every article replacing 123 with Subtext’s view count and 456 with the WordPress article id. As my blog was previously on Blogger.com which doesn’t provide view counts they are a year or so lower than reality.

Preserving links

I chose a custom permalink format of /blog/%year%/%monthnum%/%day%/%postname% which gives //damieng.com/blog/2007/10/01/first-of-october for posts. This is similar to the old format of http://www.damieng.com/blog/2007/10/01/first-of-october.aspx but obviously has the file extension and www dropped. Apache’s .htaccess file made redirecting the old links a breeze which was important to me as my blog suffered big drops in Technorati and Google when I last moved from Blogger.com to Subtext. The required lines to achieve this, redirect /blog/ and keep the RSS going were:

RedirectMatch permanent ^/blog/archive/(.*).aspx$ //damieng.com/blog/$1
RedirectMatch permanent ^/blog/$ //damieng.com/
RedirectMatch permanent ^/blog$ //damieng.com/
RedirectMatch permanent ^/blog/rss.aspx //damieng.com/feed
RedirectMatch permanent ^/blog/Rss.aspx //damieng.com/feed

Editing

The default editor is fast and for the most part okay although it lacks the ability to change from the default paragraph tag to headings, pre-formatted blocks, blockquotes etc. It also very annoyingly tries to be helpful by turning carriage returns into new paragraphs which would be fine if it was clever enough to leave <pre> blocks well alone.

Steve suggested FCKeditor which is very slow at initialising on my machine and also tends to really mess up my HTML :(

Going forward

There are still a number of things I want to do including further deviating from the Redoable theme. Lightening up the look somewhat perhaps with some soft gradients and alternative typefaces will go a long-way. I’ll also want to do a proper logo at some point as soon as I can decide what it should look like.

Being that WordPress is a higher visibility target Phrixus suggested hiding the wp-admin directory as an extra level of protection against automated vulnerability/brute-force attacks which I shall also try.

I need to speak to GrinGod about the download counting mechanism he mentioned too.

The original Blogger.com content from a year or two ago will be phased out/removed as it would appear it dilutes my page rank having almost-identical content elsewhere not to mention messing up traffic stats etc.

[)amien

Moving home  

I have been planning on moving my blog off my little Windows Shuttle PC at home onto a hosted service for some time and the latest flurry of activity followed by DSL line meltdown was enough to give me the nudge I needed to get the job done.

Rob Conery provided a useful .NET/Subsonic app to make the transition from Subtext about as painless as possible bar the obvious one of going with a PHP based solution when I know .NET is a better technology.

I simply felt the .NET blogging engines didn’t give me what I want right now and yes, I know I should be contributing to them to get them where I want them but I’m just so busy on various projects that if I was coding a blog in the evenings I wouldn’t be writing on it. Hopefully the great, and no doubt equally busy, guys behind those engines will forgive my little foray into WordPress for a while.

The non-blog parts of the web site (yes, there are some, with downloads, fonts, cursors, little tools and a mini-biography) will be integrated with the site shortly and the theme will probably gradually change to something more me. I also want to add a few extra things, the tag cloud and identicons for a start.

The title of this post also has a second meaning… yes, I’ve put an offer in on a house and will hopefully be taking possession in around 6 weeks providing nothing goes wrong.

Your invite to the house warming party will be in the post…

[)amien

Subtext .NET blogging system 1.9 released  

My favourite .NET blogging system, Subtext, is celebrating it’s first .NET 2.0 compatible release known as Subtext 1.9.

Hack and the team have worked hard on getting it out so here’s a thanks to them.

I’ve deployed it here with only a couple of minor issues which are most likely due to me previously running a self-modified version off the Subversion trunk. As a result it didn’t quite detect that it needed to upgrade the database nor that my skin was missing and it should use something else for now.

If anyone else has the same problem simply remove the 1.9.0 record from your subversion_version table and it should upgrade the tables and stored procedures appropriately.

Now Subtext is a Web Application Project you can add a deployment project so deploying to live is only two clicks away (you’ll need to install Web Application Project and Web Deployment Project upgrades to VS 2005 first until SP1 gets here)

  1. Right-click on Subtext.Web and choose Add Web Deployment Project
  2. Accept the defaults by clicking OK
  3. Right mouse button on your new Subtext.Web.csproj_deploy deployment project and choose Property Pages
  4. Set the output folder to the path to your blog’s home on your live server and hit OK

So now we have almost what we need but we don’t want the live server being deployed to every time we build so:

  1. Right-click on the SubtextSolution and choose Configuration Manager
  2. Uncheck the build for Subtext.Web.csproj_deploy and press Close

Now you can modify, run, debug and test safely on your dev machine until you are happy it’s ready for live.

To deploy to live either build in Release mode or right-click on Subtext.Web.csproj_deploy and choose build.

You can also have the deployment project replace sections of the web.config on the target machine – useful when your live server connects to a different database for example.

[)amien

From Blogger to SubText – Export psuedo BlogML from Blogger  

Getting my blog out of Blogger.com and into Subtext was not as easy as I’d hoped…

What is BlogML?

BlogML is an XML format designed to encapsulate a blog, it’s posts, comments and categories. Sounds great for transferring between blogs… Alas while SubText and many other engines support it Blogger.com does not.

A simple category-less BlogML file without comments looks something like this;

<blog root-url="www.damieng.com/blog/" date-created="2006-04-25T01:02:25" xmlns="http://www.blogml.com/2006/01/BlogML" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<title type="text">damieng</title>
<sub-title type="text">Random musings from Guernsey</sub-title>
<author name="Damien Guard" email="damieng@gmail.com">
<posts>
<post id="113889650370084235" date-created="2006-04-20T01:53:00" date-modified="2006-04-20T01:53:00" approved="true" post-url="http://www.damieng.com/blog/2006/04/hello.html">
<title type="text">Hello</title>
<content type="text"><![CDATA[This is a blog post<br />With HTML!]]></content>
</posts>
</author>
</blog>

Check out the BlogML standard itself for full details although doing so requires registration.The first thing to do is to enter Blogger.com and change the settings for your blog. Specifically you want to go to Formatting Settings and enter 999 and Posts next to Show. If you have more than 99 posts you might have problems.

Setting options on Blogger

Set the Timestamp Format to 4/25/2006 10:38:00AM (obviously the date will be different, it’s the format we’re after) and set Enable Float Alignment to No.

Go to the Comments section and set the Comments Timestamp Format to the same.

Changing the Blogger template

By changing the template we can get Blogger.com to output something close to BlogML but not quite there.

Paste the following block into the template area but DO NOT hit save.

<?xml version="1.0" encoding="<$BlogEncoding$>"?>
<blog root-url="damieng.com" xmlns="http://www.blogml.com/2006/01/BlogML" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<title type="text"><$BlogTitle$></title>
<sub-title type="text"><![CDATA[<$BlogDescription$>]]></sub-title>
<author name="<$BlogOwnerFullName$>" email="<$BlogOwnerEmail$>" />
<categories />
<posts>
<Blogger><post id="<$BlogItemNumber$>" date-created="<$BlogItemDateTime$>" date-modified="<$BlogItemDateTime$>" approved="true" post-url="<$BlogItemPermalinkURL$>">
<title type="text"><![CDATA[<$BlogItemTitle$>]]></title>
<content type="text"><![CDATA[<$BlogItemBody$>]]></content>
<comments>
<BlogItemComments><comment id="<$BlogCommentNumber$>" date-created="<$BlogCommentDateTime$>" date-modified="<$BlogCommentDateTime$>" approved="true" user-name="" user-url="">
<title type="text"></title>
<content type="text"><![CDATA[<$BlogCommentBody$>]]></content>
<author><![CDATA[<$BlogCommentAuthor$>]]></author>
</comment></BlogItemComments>
</comments>
</post>
</Blogger>
</posts>
</blog>

Now hit the Preview button and wait. Once complete, view source and save that somewhere. Feel free now to cancel the template change.

Patching up the bad output

The output from this template isn’t BlogML yet but it’s not too far off. Cut out the junk before <? xml and and after </blog> to get one step closer.

Now that just leaves us with three problems.

  1. Date/time formats are incorrect for both posts and comments
  2. Comments have no titles
  3. Comment authors are in <author> tags encoded as a CDATA hyper link instead of user-name and user-url attributes of the <comment> tag

These are all limitations of the Blogger template system but with a short XML parser and writer you should be able to fix them up.

[)amien