Daniel Cazzulino's Blog : How to cross post entries across blogs from Windows Live Writer

How to cross post entries across blogs from Windows Live Writer

I think I’m not the first guy to end up in this situation: I created a lot of content (and loyal readers) on some blog hosting site (in my case http://weblogs.asp.net) and now I want to move on, maybe with a self-hosted solution, maybe with Blogger and its custom domain support, whatever.

There are two separate issues:

  1. You don’t want to start on your new site with zero content. You have created a TON of it on the old site. This batch migration process can be painful and you may need to write code to do it. Typically you’ll want to leave on the old site just a “teaser” of your entries, and a link to your new cool site. At the very least, you want to leave a link.

At this point I hope you realize that the “why not an HTTP 301 and that’s it?” is not a valid answer for pretty much any blog hosting site I know of. They won’t do that kind of redirect if you want to move off, and there’s still the question of compatibility of URLs generated by your new blogging engine, etc. I’d keep it “simple” and add a link to the old entries automatically using some blogging API your engine must surely expose.

  1. You don’t want to lose the traffic that the old (but surely much better established) community site used to generate. On my current blog at Clarius, more than half the traffic is still coming from http://weblogs.asp.net. I only started tracking this recently through Google Analytics (post for another day) so it may very well have been much higher percentage when I had just moved.

Also, once you have moved to the new site, in order to keep the old one bringing traffic, you may want to cross-post (either full entries or summaries/teasers) to the old one, so that people start coming to your new blog to read the entries and leave comments.

You might be thinking: in order to just post the same content in two different blogs, all I need to do is write my entry, Publish to one blog account in WLW, then switch to another blog account, and post again. True, but that way you have basically forked your traffic and your audience: now users will be posting comments on both entries, oblivious to the fact that there’s one new location that you’d rather have them use. Also, because your old blog has been around for more time and in an established community, those are the entries that will more likely be linked by others and shown first on search engine results, etc. All that will go against your goal of moving people over to your new site.

So what I did to solve issue 2) is create a WLW plugin that allows me to cross-post blog entries (summaries or full posts, at my choice) that link back to my main/new blog, all with a single click:

image

And I provide some plugin options too:

image

image

The options deserve some more explanation besides being quite obvious:

  • Target blog: this is a dropdown that shows all the blog accounts you have currently registered in WLW. The “source” blog will always be the one you’re editing and publishing the current blog entry to.
  • Post summary: if checked, the cross-post will only contain the first 500 (200 is the default) characters of your current entry.
  • Preview post: this option (true by default) allows you to see in WLW the generated summary or full entry with back-link, and it will show up with the target blog selected in WLW, as well as a new Draft that you can save, publish, delete, etc. Once you get more confident with how the plugin works, you’ll typically want to unckeck this option, as it’s pretty annoying to end up with duplicate titles in your “Recently Posted” sidebar for every entry.

My plugin is leveraging all of WLW features for posting, so if you can post to a blog from WLW, you can cross-post to it with my plugin too.

With the options above, here’s what I got for one of my recent entries on PowerShell:

image

The plugin will automatically add the “…” when the characters limit is reached, append a link with an icon pointint to the full article in your source blog, and also a full link at the bottom. It’s interesting to note that I’m not doing just a string.Substring there. That would either break the HTML pretty bad, or I’d have to post only the text content value of the HTML, which would break code blocks, styles, etc. as it would not include any markup. Instead, what I’m doing is the “right thing” by having an internal custom XmlReader that counts the characters it reads from text nodes and starts reporting stops reading further (but does report end elements for all ones from the current location). In the case above, you can see that the character count was exceeded while in the middle of some code (typically a <pre> element), yet the image link is displayed correctly, as well as the full link.

Installation is trivial. From the project release page, you can either:

  • Get the MSI installer. It will just copy the plugin dll to your plugins folder under the WLW install location (will look for %ProgramFiles%\Windows Live Writer\Plugins)
  • Get the binaries. Copy the included files to the above location manually.
  • Get the sources. Open the solution in VS2005. Build. An AfterBuild target will attempt to copy the output to the above location, so you should even be able to run/debug from there.

I submitted the plugin to the Windows Live Gallery, so it may show up there too :)

Enjoy!

/kzu

/kzu dev↻d