DotNetKicks "Kick It" Counter Plugin for Windows Live Writer
Some people write pretty quality .NET-related blog posts every time. You know, stuff worth posting and kicking on DotNetKicks. Then there’s people, like me, who obscure the occasional “good” post with a mountain of crap. If you don’t know what DotNetKicks is, I encourage you to check it out. It’s a great community-edited feed of .NET-related posts, with minimal “noise”.
I found myself wanting to add a “kick it” counter on some of my posts to enable people to easily kick them (via their blog reader, for example), but not on every post. I mean, who wants to kick a post about contacting me? Not even I do!
Here would be the process with what I’ve currently got:
- Write a kick-worthy post.
- Publish the post.
- Get the permalink for the post in question.
- Submit the post on DotNetKicks.com, and copy the HTML for the “kick it” counter.
- Add the HTML to my just-posted post, and re-publish the updated version.
Way too manual. So after a little research and a little coding today, here’s my new process:
- Write a kick-worthy post.
- Click from Windows Live Writer.
It’s simple, really: adding the “kick it” counter requires knowing the permalink of a particular post. That prevents me from inserting it for real at creation time, because the permalink isn’t known until the post is published. I could just add the “kick it” code to my wordpress template, but as I originally mentioned, I don’t want it on every post – just some. (Yes, I realize I’m overcomplicating things – it’s my blog though. 🙂 )
Unfortunately any solution, including mine, will require some cooperation between Windows Live Writer and the blogging platform. Mine includes a Windows Live Writer plugin and a WordPress plugin. The Windows Live Writer plugin adds a placeholder (“<!–dotnetkickit–>”) to the post, and the WordPress plugin transforms the placeholder into the “kick it” image/link HTML at render time.
Windows Live Writer Plugin
Click it and, like any other inserted item, a default “kick it” image is added.
This image is static, and is just for layout purposes only – Windows Live Writer allows plugins to insert different “editor” versus “published” HTML. When editing, I insert a static image so you can get the look-and-feel, and when published, only the “<!–dotnetkickit–>” placeholder gets inserted. Pretty nice on the part of Windows Live Writer to expose that functionality.
That’s really all there is to the plugin, it’s pretty basic. It doesn’t (currently) allow you to change any of the colors, but that’s something you could manually update in the WordPress plugin itself, if you want.
To install the plugin, download and run the MSI available on my garage sale code page listed under “DotNetKicks Windows Live Writer Plugin”.
The WordPress plugin is beyond simple, partly thanks to the extensibility support the WordPress developers have built in. The plugin adds a filter that modifies the post content before it gets displayed in the browser. Note that I don’t actually modify the stored post content itself – I want to be able to turn this off and have the “kick it” counters go away.
To install, download and unzip the dotnetkicks.php file from my garage sale code page (listed under “DotNetKicks WordPress Plugin”). Just upload it to your wp-content\plugins subfolder, and activate it from your admin page:
After activating, you’ll see the “kick it” image on the appropriate posts.
If anybody wants to create plugins or whatever for other blogging platforms that will interpret this placeholder, post a comment here with a link to your implementation!
The moment we’ve all been waiting for – I’m going to make use of the barely useful tools I created! Feel free to kick this post. 🙂