Monday, July 21, 2003

Movable Type enhancement

Over at my Dean campaign blog, I mentioned that I helped the campaign update the official campaign blog over the weekend. Specifically, we added permalinks to comments and added “mail this entry to a friend” functionality. Both are simple tweaks to Movable Type that greatly enhance the weblog. One of my readers asked how I did it, so I’m posting the answer here.



Probably not a bad idea to back up your templates before proceeding, by the way…



Comment permalinks. (Note: This assumes you’re publishing comments on your individual entry template and not in a pop-up window.) Find the spot in your individual entry template where is. Ahead of that code, insert the following:



<a>"&gt;&nbsp;</a>


Decide where you want the permalink link to go; at the Dean blog, we put it immediately after the date (which is likely in your template as ). Insert the following HTML:



<a>#"&gt;Link</a>


Republish your site. Now all comments have permalinks.



Mail this entry to a friend. This is actually in the Movable Type documentation. The only thing I modified here was to add an HTML anchor to the top of the code included in the doc so that when people link to it from the blog’s home page, the link takes them directly to the e-mail form. (See the results by visiting the Dean campaign blog.) The first line of the code from the MT code should look like:



<a name="Mail"><form method="post">mt-send-entry.cgi"&gt;</a>


Once you add the form to your individual entry template, add a link to the form from your Main Index template. We put the link in between the permalink and the Trackback link. The HTML should look like this:



<a>#Mail"&gt;Mail This Entry to a Friend</a>


Of course, you can change the link titles for either of these enhancements; I just included the code as written so you could see what we did.

1 comment:

  1. Rick, thanks for the pointers, they worked perfectly!

    I have it all working now here for example

    ReplyDelete