Friday, January 9, 2009

Using Windows Live Writer with Google’s Blogger

After some time of interruption I start to blog again.

To mark this event I decided to assign a new domain name for my blog address, http://blog.hosimauthuc.net, as you have seen.

I came across Windows Live Writer (WLW) while playing with BlogSvc, an open source ASP.NET 3.5 blog engine built with ASP.NET MVC framework. I found Windows Live Writer quite useful as a blog authoring tool, especially in the following points:

  • It allows me to author my blog posts offline. When I get online, just one mouse click will bring the post to my blog.
  • It uses my blog theme inside its IDE. I can almost write and preview my posts as the same time.
  • It has plug-ins to support formatting code examples.

The last point is quite important for technical bloggers like me. Leo Vildosola’s plug-in is a popular one (downloadable from here). Here below is a code snippet example created with Leo’s tool:

   1: public ActionResult Search()
   2: {
   3:     string query = Request.Form["keywords"];
   4:     char[] par = { ' ' };
   5:     string[] keywords = query.Split(par);
   6:     ResourceStorage rs = SearchService.SearchByKeywords(keywords);
   7:     rs.Name = query;
   8:  
   9:     return View("Search", new SearchResults(rs));
  10: }

Some kind souls in the above places have recommended the following two tips to get a clean display:
  • Remove max-height attribute from the generated source to get rid of the vertical scroll bar.
  • Change WLW’s blog settings to generate HTML markup (instead of XHTML as the default one) to avoid broken style when writing blogs for Google’s Blogger.
BlogSettings

I discovered that sometimes WLW's generated markups don't fit my expectation on Blogger (this may happen for Blogger only). Under those circumstances I log on to Blogger and perform final layout clean-up there.