Webdev: September 2007 Archives

When I started using the default templates coming with Movable Type 4, I missed the Recent Comments widget. Below I explain how you can add create this widget and ass it to your sidebar in true MT4 style.

In the Movable Type administrative interface, go to Design > Templates > Template Modules and open either the 'Sidebar - 2 Column Layout' or the 'Sidebar - 3 Column Layout' template module, depending on which one you are using. Scroll down until you find a line with <MTIf name="module_recent_comments"> and paste the following code just above that line (you can of course also choose another position for the recent comments widget):

<MTIf name="module_recent_comments">
<div class="widget-archives widget">
<h3 class="widget-header">Recent Comments</h3>
<div class="widget-content">
<ul class="widget-list">
<MTComments lastn="5" sort_order="descend">
<MTCommentEntry>
<li class="widget-list-item"><a href="<$MTEntryPermalink$>#comment-<$MTCommentID$>"><$MTCommentAuthor$></a> on <a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></li>
</MTCommentEntry>
</MTComments>
</ul>
</div>
</div>
</MTIf>
Now in any template where you want to show the recent comments (e.g. the main index template or the individual archive template) you add the following line:

<MTSetVar name="module_recent_comments" value="1">


Rebuild your weblog, and it should show you the five latest comments in the sidebar, just as you can see on this blog.
MT4Widgets are the fastest and easiest way to configure your sidebar. Just open up the widget administrator and drag and drop widgets on the sidebar. A great feature for novice bloggers, who don't have the technical knowledge to tweak sidebar templates.

Unfortunately, the default Movable Type templates don't use widgets, which means that to enable widgets on your site you will have to tweak the sidebar template... ouch!

I know, the default sidebar template offers a far more advanced features then the widget engine can offer, with viarables and MTIf constructions. The default sidebar template is a lot cooler without widgets, but also very hard to tweak.

In my opinion, the default sidebar template should include a check on the number of widgets configured. If no widgets have been configured, it should show the fancy sidebar, but as soon as I configure widgets, it should hide the normal sidebar and show the widgets. This is also what many templates in WordPress do and gives you the both of two sides: a fancy sidebar for starters which is easily adaptable by weblog owners.
Behind the screens, various big changes are happening on my blogging environment. As you see in the sidebar, I currently maintain have four weblogs. The oldest of the four is Brain Tags, running since ages on Movable Type. Then I have a weblog called The Wizard of POS, until today running on the same MT installation as Brain Tags and available at pos.braintags.com. There is also an old blog about my web hosting adventures, which I haven't updated in ages, called Brytenet weblog and just as the rest of the Brytenet site managed with eZ Publish. And finally I have my successful Spanish productivity blog El Canasto maganed with WordPress.

Quite a mess, isn't it? Add to that the fact that I have been experimenting a lot with non-public weblogs, and you'll get an idea of what things look like.

mt4.pngSo I decided to clean things up, and do it well. You'll notice from the links in the side bar that I have presented my blogs as The Brain Network, a name I never have been satisfied with. Anyway, I acquired a new short and flashy domain name (of course hosted by Brytenet) and made a fresh MT4 installation. This will be the home of Brain Tags, The Wizard of POS, El Canasto and a new network blog (I still have to decide whether I want to continue with the Brytenet Weblog). Until now I have re-created The Wizard of POS, imported all existing entries, comments and trackbacks, and tweaked the default template. And by the way, I gave it its own domain name, pos-wizard.com.

There is still a lot of work to be done (and I have little time), but I already feel good about the new home for my weblogs and am looking forward to being able to manage all my blogs from a single screen.