Dynamic Template Plug-in for Windows Live Writer

Posted by Dan on Feb 12, 2008 @ 2:32 PM

I've been using Windows Live Writer for posting all my blogs. Overall it's a terrific program. It's got a very simple, easy to use interface and it drastically eases the process of blogging.

However, the one complaint I've had with the program is there's no easy way to "add" common HTML tags that you commonly use to the interface. I use the <samp> tag quite frequently when showing inline sample code and for variable names (although I suppose I should use the <var> tag instead.) To use these tags I've had to drop to the HTML Code view and manually add the tags. This is a pain to do—especially on longer posts where I need to add the tag frequently.

To solve my dilemma, I've been periodically searching for a Live Writer Plug-in that might allow me to add some custom HTML snippets. Well today I just happened to stumble on a great little plug-in called Dynamic Template Plugin for Windows Live Writer.

You can use this plug-in for doing something as inserting static text or for modifying the selected text. The real power comes from the fact that the plug-in allows you to use C# code snippets. You can even have the template prompt you for input.

To get you started, here are a couple of templates I just wrote to help me out with a few tasks:

Insert "UPDATED" text
This snippet will place an updated time/date stamp wherever your cursor is. This can be useful to quickly add an UPDATED tag to the beginning of a post.

<strong>[UPDATED: <%= DateTime.Now.ToLongDateString() %> at <%= DateTime.Now.ToLongTimeString() %>]</strong>

Insert "SAMP" tag
This snippet will wrap the selected text in a <samp> tag. You can obviously use this as a template to wrap any selected code in any HTML tag.

<samp><%= _selection %></samp>

Insert Timestamp
This snippet insert the current time in the format: 2:28:19 PM -

<strong><%= DateTime.Now.ToLongTimeString() %> - </strong>

There's really a ton of power in this plug-in and this is exactly the type of plug-in I've been looking for. The only improvement I'd like to see is a way to streamline choosing the template to insert. As it stands now, you need to click on the "Insert Template..." link and that displays a dialog of all your templates. It would be great if there was a toolbar button (like the Insert button) with all the templates listed as a drop down. This would just speed up the process a little bit.

Go download the Dynamic Template Plug-in now to drastically your improve Live Writer experience.

Categories: Source Code, Technology, Personal

5 Comments

  • Thanks for the tip Dan. I've just started using Windows Live Writer myself and I'm finding it quite good to use - this plugin will definitely help take things to the next level though :) Great find!
  • @Justin:

    Make sure to share any cool templates you come up with. Joe's got a couple of other cool sample templates on the website as well. The HTMLize template could definitely prove useful.

    On a non-related note, you either are a dead ringer for Mike Portnoy or your a DT fan. Of course I'm basing this on your X360 Gamer Tag on your website. :)
  • @Dan: ROFL, yeah that's Mike Portnoy :P I saw them a couple of weeks ago here in Aus - best gig I have ever experienced in my life! \m/

    I'll definitely post any templates. The first one I thought of was for wrapping code in the HTML required for the dp.SyntaxHighlighter script that I use on my blog.
  • That is freaking great. I use dpSyntaxHighligther to post code snippets to here the xml code snippet I just threw together:
    <pre class="xml" name="code">
    <%= xmlCode.Replace("<", "&lt;").Replace(">", "&gt;") %>
    </pre>
    where "xmlCode" is the name of the variable and the template uses a multiline textbox.
  • Thank you

Add Comment

Leave this field empty