MovableType

Death Announcement Day

On another website, I saw a post which provoked commenters to consider the problems of blogging after death. I.e. what happens to the site, will it just fizzle out, or would the site notify the readers somehow? I made the following comment, which worries me, as I didn't realise I'd given quite that much thought to this issue!

"Although I guess if you have a fairly popular blog you could always use it as a cheap will. Just always have a post with the info dated two weeks or so in advance and update it before it gets posted each time.”

I've thought of that before, the only reason I don't do it is the thought of "What if I forget"?

So I think it would need a plugin….

Fo ease of coding what follows the post might need to be held seperately to regular posts, relying on the plugin to copy it to the appropriate place in the database

On each successful login, the date is automatically updated (to be N weeks after the last login). N would be customisable. (say, 4 weeks default)

At a fixed time (three weeks default? this allows for a long holiday) before D-A-D (death announcement day), the plugin would email all the contact addresses which you've registered to it ("are you dead?" messages - it'd provide a link for you to follow if alive). It'd only send these to confirmed email addresses!

These emails would be resent at intervals (user settable)

At some other time (say, D-A-D minus 1 week by default) before D-A-D a post would be made to say "the owner of this website has not updated it in some time, and apologises for this - an explanation will come shortly" (this serves to alert the owner via other means, rss, the website page etc - without alarming people if it's a false alarm. The post might encourage people who know the owner personally to phone direct for an early explanation, thus either providing another alert, or allowing news to be broken in person)

The default text of the post would be worded such that it on a subsequent login the reason could be "busy with work" or something….

Shortly before D-A-D, say 24 hours beforehand, the plugin would try the emails again, with very obvious subject lines demanding urgent action.

Of course, all the times, alerts and posts would be customisable… And any login resets the clock! For a multiple user system, this'd be on a "per login" basis (settable by the admin) - if offered, some users could switch it off.

Nice extras: The plugin might provide some way for the blogger to specify "trusted users" - who could receive emails D-A-D be imminent, and who would be trusted to amend the D-A-D message with exact circumstances of death or serious illness. These people would be told exactly how to do this in the email. The trusted users would be told of the OTHER trusted users so they co-ordinate. It may be possible to specify degrees of trust (e.g. trustworthy acquaintance who will do as asked, but is unlikely to get emotional - or trusted family member who may not want to go editing blog posts at a time of concern - the acquaintance can't change the family member edits, but the family member can change the acquaintances)….

Do you think, perhaps, that I've given this way too much thought?

A simple version could be done via the 'future post' ability of most comment website software, however this could easily be forgotten - I'd aim for the post only to appear if there really was nobody to stop it appearing! Yes, a dead man's switch might be a good alternative, but you're reliant on someone else to make the post, with the reminding system above, other people only come in as an optional 'tweak' to the post.

I already have a post set to go 'live' in february 2007, so if anything happens to me before then, it may give some people a shock!

Recent Pings

I wanted to re-do my 'recent pings' code for trackbacks from other sites. This appears on my homepage.

The criteria were:

  1. Only display pings from elsewhere (not internal pings)
  2. Display N pings.

These required me to keep count of how many pings had been displayed, and not display internal pings. (I couldn't just say 'only show N pings', and then not show a subset as the length of the list would change.)

Here's the code:

<MTSetVar2 name="count" value="0">
<MTIfPingsActive>

<div class="module">

<h2 class="module-header">Received Pings</h2>
  <div class="module-content">
  <ul class="module-list">

    <MTPings sort_order="descend">
      <MTIfLess a="[MTGetVar2 name='count']" b="10" numeric="1">
        <MTIfNotEqual a="[MTBlogName]" b="[MTPingBlogName]">

        <li class="module-list-item"><MTPingedEntry> <a 
        href="<$MTPingedEntryLink$>" 
        title="<$MTPingedEntryTitle$>"><$MTPingedEntryTitle$></a> 

        pinged by 

        </MTPingedEntry><a href="<$MTPingURL 
        encode_ampersands="1"$>"
        title="<$MTPingDate$> - <$MTPingExcerpt remove_html="1" 
        strip_linefeeds="1"
        encode_ampersands="1"$> - from <$MTPingBlogName 
        encode_xml="1"$>"><$MTPingTitle
        strip_linefeeds="1" 
        remove_html="1" encode_ampersands="1"$></a></li>

        <MTAddVar name="count" value="1">
        </MTIfNotEqual>
      </MTIfLess>
    </MTPings>

    </ul>
  </div>
</div>
</MTIfPingsActive>

This code requires the use of several plugins to movabletype.

These are listed below:

  1. Arithmetic which in turn requires Expressions
  2. MTCompare
  3. MTPingedEntry (original site)
  4. Amputator

Essentially, this piece of code will first set a count to zero, then it will work through the list of trackback pings. Whenever the count is less than 10, it will start to process the ping (i.e. it only does 10 pings). The details of the ping are output, and the count is incremented.

The Amputator plugin provides the encode_ampersands filter. This helps to ensure valid HTML is produced (the & symbol in URLs should be written as &amp; when that URL is in a webpage)

Looking at Notifier Subscribers

I found myself becoming curious regarding the email notification feature, provided by MT-Notifier. Who was subscribing to receive comment notifications? Was it working at all? Therefore, I made use of the MTSQL plugin to find out.

The first step was to create a subdirectory which I could use to hold the results, but which wasn't visible to the outside world. I created the directory, then used cpanel to password protect it. I could have also used .htaccess.

Then I installed the MTSQL plugin.

Finally I made a template within movable type. This is an index template, set to save into my password protected directory.

This template relies upon the MTSQL plugin.

It also assumes several other files, these are optional. I wanted to be able to 'filter' for certain types of email, i.e. confirmed email addresses and those still pending. These pending emails could be due to spam, or simply to folks who have not confirmed yet. The additional files are placed in the directory where the webpage will be generated.

Firstly there is the CSS chooser javascript, available here.

Then there are three stylesheets, subs.css, which contains these declarations:

li.showvalid {background-color: inherit; color:inherit;} li.showpending {background-color:inherit: color:inherit;} tr.PENDING {background-color: #ffbbbb; color: inherit;}

validonly.css has these: .PENDING {display:none} li.showvalid {background-color:#ffbbbb; color:inherit;} li.showpending {background-color: inherit; color:inherit;}

and pendingonly.css has these: li.showpending {background-color:#ffbbbb; color:inherit;} li.showvalid {background-color:inherit: color:inherit;} tr.PENDING {background-color:inherit; color: inherit;}

The effect of these is that when all the notifications are shown, the pending ones are highlighted red, and when only the valid or pending are shown, the choice is highlighted.

The template can now be built, and a list is made of people who have subscribed to be notified of comments made on various posts. It should be highlighted that this is created within a password protected folder (not linked to), so it should keep the email addresses safe - it's purely for my curiousity!

A future step is to try and work out how to purge the database, i.e. delete any pending notification which has been pending for, say, 7 days. That screams 'scary perl script' to me. Heck, I don't even know if the timestamp is stored along with the notify email! The ideal would be to be able to put a button onto the generated webpage which one could click to purge an email address (with a persistant checkbox which would override 'are you sure' messages if required). If anyone knows how this might be done, I'd love to know!

Relative to Absolute - Desired Movabletype Plugin

It is good practice to use relative links for a variety of reasons, however, within RSS feeds this can cause problems, as the links are often interpreted as relative to the page where the RSS is viewed, not relative to the source page. For example, this link works fine when viewed on my site, it links to the 'top level' page, but might break when in an aggregator. I'm not really happy to go back and change relative links to absolute links, this seems like a lot of hassle - and I don't really want to use absolute links in the future. Therefore, a plugin for movabletype seems ideal - unfortunately I don't have the perl skills to do it!

There is a plugin which takes absolute URLs generated by MT and makes them relative. I'm looking to do the reverse for relative URLS within posts that I need to make absolute for RSS purposes.

It'd be called 'Relative2Absolute' and would be a text processing option (a bit like the Amputator plugin) which monitors for relative links, and when detected, subsitutes a base URL in front of them. As a first pass it could match anything which is a href=" but not a href="http://

This would then let the RSS feeds be filtered to use absolute links, but leave the relative links within posts untouched.

Email Notification

I have finally got around to adding a feature which allows commenters to ask for followup comments to be sent to them by email. The commenter can opt whether or not to receive these emails, and before any emails are sent the address will need to be verified, this is to prevent the site being used to spam people. This is on a post by post basis. People who subscribe using this feature can cancel a subscription for a particular post, or for the whole site, by following the instructions in the email. This should prevent people becoming deluged in the unlikely event that a comment thread 'takes off'.

This is in addition to the XML feeds provided for each post.

Please report any bugs by commenting upon this (or indeed any) post, though this post is the best place!

Remember, if you're an 'unknown' poster the comment may enter moderation. Blame the spammers for this. I will 'whitelist' regular commenters to bypass this feature. If that applies to you, and I have yet to whitelist you, please comment here and I will address this).

One more Firefox Plugin

I have created one more plugin for firefox, this one is useful for users of Movabletype. The plugin allows the user to search the excellent MTLookup site from within the firefox browser. This was created as I recently wanted to look something up using MTLookup, and for some reason I could not remember the name of the site, and I had not bookmarked it as it was an obvious name! Doh!

Previous plugins include the search box for this site, as well as a search box for BorisBlog.

It seems reasonable at this point to reference the extension 'SearchPluginHacks'.

More MT related firefox plugins can be found here

(Update: This plugin linked to by the creator of mtlookup - I just hope that a rewrite is not needed when V3 of mtlookup is created!)

Mobile Phone

When I got my new phone last year, one of the first things I did was ask 'how does my page look?' Perhaps unsurprisingly for those who know about this sort of thing, it did not 'look' like anything as it didn't even load. I did a little research today, and following a google search I found nicely toasted. Some editing yielded a movable type template for this site. The output file is here, but will only be readable on a mobile device (or firefox, with a wml plugin).

I have been trying to get a redirect for wml browsers to automatically go to this page, but I haven't been able to make it work without changing the url for THIS page. I didn't want to do it with javascript as many phones have JS switched off. I tried .htaccess, but no luck, I even tried an index.php which did the business for the PC end, but didn't redirect the WML side of things. Ah well....

I have set up the subdomain wap.murky.org, and hope to make this slightly more usable with time - though I don't feel any great urgency, if I'm honest. It is just a geeky thing to do!

Spam Upsurge

I have been getting an increasing amount of comment spam of late. Nightly there have been multiple posts along the lines of 'Nice blog, keep up the good work', and 'I can't believe I have never run across your site before'. You might wonder where the spam in this is, the thing is that there are hundreds of them, many identical on multiple posts, and seem to exist purely to direct traffic to another site (which is one of a range of sites).

Not one of these has reached the live pages, yet the spammer keeps trying. Idiot. I know they probably aren't checking that every spam gets through, but you'd expect them to check from time to time!

All that happens is that the comments go into moderation (as do all comments, unless the commenter is signed in through typekey) and then get deleted. A lot of the known spams are deleted on sight.

Movabletype 3.2 makes the management of spam easy, though - it comes with spamlookup which has filtered out all the spam messages with ease. It takes a few clicks to junk multiple spammed messages.

Of course, if I have junked any genuine 'nice site' messages in the process - I do apologise!

Google Sitemaps

Note - I no longer use MT.


A while ago, google launched their sitemap protocol. A sitemap is an XML file which points at all the pages on the site and helps google to index the site efficiently.

It indicates to google which pages are updated frequently, how important pages are (within the site) and so forth.

If you're running movabletype as I am, you won't get a sitemap template by default, even if you're using MT3.2. Never fear! You can 'borrow' my sitemap index template

You may need to modify it if you're using different types of archive to me. Be aware that the priority tag is only important in the context of your site, you can't improve your ranking by giving things a silly number. Priority tells google that, given two pages with the same matches on your site, which one is more important. [more info]

I have given the homepage a priority of 1, recent articles are pretty important, but I've given the archive pages more importance than old individual entry pages. Note that I have an explicit link to an index on my site which may well not exist on yours!

The relative importance and update frequency are advisory only. Google may well ignore them!

The resulting sitemap is pretty boring to read, but it could reduce spidering traffic.

Once your sitemap is created, you need to submit it to google (it is a shame that there isn't an autodiscovery thing, it could then be picked up by other bots). The sitemap isn't picked up instantly, so you will need to come back to check for errors.

As I write, I haven't put in a 'last modified field' for category or date archives. I aim to do this and when I do the linked template will quietly change.

Your sitemap should rebuild with the site, and a good output name is sitemap.xml

Now... are any of the other search engines using sitemaps?

Further reading: Tips for Blogger Google Sitemaps could work against webmasters Google Sitemaps just got better Google Sitemap for Idiots How to make use of Google Sitemaps Yahoo Submitpage has it's own sitelist: "You can also provide the location of a text file containing a list of URLs, one URL per line, say urllist.txt. We also recognize compressed versions of the file, say urllist.gz"

Movabletype Plugin Updates

Some useful Movabletype plugins have been updated, StyleCatcher, which shipped with MT3.2 has been updated. Note that you can edit the MT templates, I have, but be careful not to change the functionality of the default classes or stylecatcher will not work for you. I changed all my templates to point at a second stylesheet, which gives my own "tweaks". This lets me change the background style with impunity... why is it that most of the styles in the MT style library are fixed width? For that matter, why is MT itself fixed width? As regular visitors may notice, I've been playing with stylecatcher for a little bit, some things change, and some things stay the same. I'll eventually come back to the green-grass based look as it is 'fluid' and resizes.

In addition, Better Entry Preview has also been updated.

I think MT-Preview does the job better that Better Entry Preview, as it uses the actual templates the article will be published with, but betterentrypreview is better than the regular preview, so it does what it says on the tin!

The downside with mt-preview [nb: instructions outdated, see above link] is that the installation is a touch tricky, though with care (and making backup copies) it doesn't take long. Better Entry Preview, on the other hand, looks easier to install, but to will require extra CSS fiddling to get the preview looking like your site.

Download your plugin and take your choice.

del.icio.this

You may have notice the new del.icio.this buttons on the site. These allow easy bookmarking in del.icio.us (yes, optimistic, I know). The bookmarked item is the individual post.

This is done by including the following in the Movabletype template, inside MTEntries:

<p class="delicious"><a href="http://del.icio.us/post?url=<$MTEntryPermalink$>&amp;title=<$MTEntryTitle encode_url="1"$>" title="Add the post entitled <$MTEntryTitle encode_url="1"$>, and JUST this post to your del.icio.us account">del.icio.this</a></p>

The style for this is as follows, I use a second stylesheet to override any of the default styles, so I just dropped this in there :

/* delicious button */

p.delicious {         font-family: courier; text-transform: uppercase;         font-size: smaller;         float: right;         border: 0px; padding: 0px         color: #fff; background-color:#9c6; }

p.delicious a {         padding: 0.2em 1em;         border: 1px outset #9c6;         color: inherit; background-color: inherit;         text-decoration: none; }

p.delicious a:hover {         border: 1px inset #9c6;         color: #880; background-color: inherit; }

p.delicious a:visited {         border: 1px inset #9c6;         color: #800; background-color: inherit; }

Of course, the styling can be changed at will (and I would be interested to learn of any nice examples).

Spam

I'm sitting in Spam Free Bliss at the moment. I had the weird experience of waking up to not one spam. McAfee Spamkiller intercepted most of them, with Thunderbird catching the rest (which I duly scolded the McAfee filter for).

On the website, there was a flurry of spammy comments and trackbacks last night, but the new SpamLookup filter built into MT3.2 just swept them all into the 'Junk' folder, in case of false positives. Not one made it to the site, no cleanup to do, as has been the case.

Sheer bliss.

(Some sites point out that MT doesn't come with new templates. This is true for upgrades as you wouldn't want it to go over modified templates. You can get the new templates by refreshing the templates with the plugin, existing templates are backed up at this point. Though one problem I had was with a new template, the plugin can only get new templates if told they exist! This template is required to get the typekey stuff working with the new templates. Stylecatcher will only work well with the updated templates, as the styles depend upon the template having pre-agreed names for certain things.)

MT-Preview

There is a Movable Type plugin called mt-preview which I like, and with the update to MT3.2 the instructions for modifying MT to use this plugin are now outdated. Therefore, I post this to help anyone googling around for an answer with respect to MT-Preview and Movabletype3.2.

The location to upload the file is the same, but the MT templates are different - so this is what I did. I used the command line, but one could just have easily used FTP, though it would have taken longer.

First, I backed up the files I was to modify cp edit_entry.tmpl edit_entry_original.tmpl cp entry_actions.tmpl entry_actions_original.tmpl

Then, I modified edit_entry.tmpl. This part is the same as before.

Somewhere in the section where the functions are defined, I added the function: function doPreview () { window.open('<TMPL_VAR NAME=SCRIPT_PATH>mt-preview.cgi?blog_id=<TMPL_VAR NAME=BLOG_ID>&entry_id=<TMPL_VAR NAME=ID>', '', 'width=600,height=500,resizable=yes,scrollbars=yes'); }

The window.open bit is on one line.

then in entry_actions.tmpl I found the line

<TMPL_IF NAME=ENTRY_EDIT>

and added this, immediately afterwards. <TMPL_UNLESS NAME=NEW_OBJECT> <input class="button" onClick="doPreview()" type="button" value="<MT_TRANS phrase="WYSIWYG">"> </TMPL_UNLESS>

What has happened here is that Sixapart spotted that the button code appeared twice in the first template, as the buttons could appear at the top or bottom of the edit_entry screen, and so they removed this code into another file, so one edit will do the job.

Recent Comments and Trackbacks

For those who may be wondering, I have obtained the 'Recent Comments' and 'Recent Trackbacks' stuff in the sidebar of the homepage using the following template code.

encode_xml is used to guard against quotes, ampersands and the like. encode_ampersands is a plugin that does the same job for URLs, changing & into &amp; in order that the page does not become invalid.

<MTIfPingsActive>
<div class="module-trackbacks module">
<h2 class="module-header">Trackbacks</h2>
<div class="module-content">
<p>Received Pings</p>
<ul class="module-list">
<MTPings lastn="5">
<li id="p<$MTPingID$>">
&raquo; <a href="<$MTPingURL encode_ampersands="1"$>"
title="<$MTPingExcerpt remove_html="1" strip_linefeeds="1"
encode_xml="1"$>"><$MTPingTitle encode_xml="1"$></a> from
<$MTPingBlogName encode_xml="1"$> (<$MTPingDate$>)</li>
</MTPings>
</ul>
</div>
</div>
</MTIfPingsActive>

<div class="module-comments module">
<h2 class="module-header">Recent Comments</h2>
<div class="module-content">
<ul class="module-list">
<MTComments lastn="5" sort_order="descend">
<li><a href="<MTCommentEntry><$MTEntryPermalink$>#c<$MTCommentID
pad="1"$></MTCommentEntry>" title="<MTCommentEntry><$MTCommentBody
strip_linefeeds="1" remove_html="1"
encode_xml="1"$></MTCommentEntry>"><MTCommentEntry><$MTEntryTitle
remove_html="1"$></MTCommentEntry></a> by <$MTCommentAuthorLink
show_email="0"$>
(<$MTCommentDate language="en" format="%a, %d %b %H:%M"$> <$MTBlogTimezone no_colon="1"$>)</li>
</MTComments>
</ul>
</div>
</div>

With changes like the above, I've changed the MT3.2 default templates a little - but I have tried to keep changes to a minimum, and keep them using the same style tags as the default styles. This is so that I can use the new StyleCatcher with impunity.

Indeed, I have put all of my stylesheet changes into a seperate stylesheet, so, the theory goes, I should just be able to 'drop in' a new base style.

Famous last words.

That isn't quite true, I do have one thing at the top of every stylesheet, and I added this to the default style:

/* Stylesheet generated on <$MTDate format="%B %e, %Y %I:%M %p"$> */

/* This is a cheap hack for an old browser bug */
td.false {font-family: serif;}

The td.false thing is only needed for REALLY old browsers. It is there because when CSS started, one of the big browsers always ignored the first style definition. The 'generated' line is most useful as it lets me quickly see that I have the latest version when I look at the stylesheet in a browser. When changing a stylesheet;, the browser sometimes uses the old version, so it is necessary to load the stylesheet in the browser and hit 'reload' to be sure to use the most up to date one.

More on the Upgrade

I've been fiddling with the website, and MT3.2 seems good.

There are a few spots where the documentation is not yet in place, for example in mt-config.cgi the URL is wrong.

Typekey authentication has stopped working, this is something to do with going back to the MT3.2 default templates (though I've now added minor tweaks). Apparently there are some new templates which I don't have. I put in a support request and was told:

... you may not have the new Site Javascript index template. This template should publish a file named mt-site.js in your weblog folder which contains the necessary TypeKey Javascript.

I have yet to find out how to GET that.

Trackbacks to this site are now subject to filtering, and it is no longer pass or dustbin, trackbacks can be held for moderation before they appear, and I can rescue trackbacks from the bitbucket too. This should make the cleanup after a small trip away much easier.

There is still a little tweaking to do with templates, but it is almost there. As of now things are at 90%, the site is certainly useable at the moment.

Movable Type

In MovableType, I have always found it annoying to have two clicks to get to the trackbacks, but the comments were available from the first page after login.

Therefore this hack. I wanted to add a 'trackback' link to the homepage.

To do this, in your installation, find the directory movabletype/tmpl/cms

Look for the file list_blog.tmpl

Back this up - if in the command line, type

cp list_blog.tmpl list_blog_backup.tmpl

Then in the file; find the line which reads:

<TMPL_IF NAME=CAN_EDIT_ENTRIES>
<li><img alt="<MT_TRANS phrase="Comments">" src="<TMPL_VAR NAME=STATIC_URI>images/mininav-comments.gif" width="9" height="11" border="0" /><a href="<TMPL_VAR NAME=SCRIPT_URL>?__mode=list_comments&blog_id=<TMPL_VAR NAME=ID>"><MT_TRANS phrase="Comments"></a></li>
</TMPL_IF>

After this, add the line:

<TMPL_IF NAME=CAN_EDIT_ENTRIES>
<li><img alt="<MT_TRANS phrase="Trackbacks">" src="<TMPL_VAR NAME=STATIC_URI>images/mininav-trackbacks.gif" width="9" height="11" border="0" /><a href="<TMPL_VAR NAME=SCRIPT_URL>?__mode=list_pings&blog_id=<TMPL_VAR NAME=ID>"><MT_TRANS phrase="Trackbacks"></a></li>
</TMPL_IF>

Save the file.

Note that mininav-trackbacks.gif does not exist, so you can either use nav-trackbacks.gif by editing the above, or copying the graphic shown here into movabletype/images. Or you could just remove the 'img' tag!

Remember, if it all goes pear shaped, you can restore your backup by:

cp list_blog_backup.tmpl list_blog.tmpl

Of course, this may have to be redone when MT3.2 is released! Oh, by the way, if sixapart want to use that icon, then please go ahead!

I have also modified it to add a WYSIWYG button and a reset activity log link, I mention these so that I only have to look in one place if I ever need to re-do the mods.

My reset activity log link is a little different to the tip on 'the girlie matters' as I am using an icon (feel free to copy, do not link to mine):

<div class="icon"><a href="<TMPL_VAR NAME=SCRIPT_URL>?__mode=reset_log&magic_token=<TMPL_VAR NAME=MAGIC_TOKEN>"><img alt="" src="<TMPL_ VAR NAME=STATIC_URI>images/frontnav-activity-log-delete.gif" width="19" height="25" border="0" /></a></div>
<div class="label"><a href="<TMPL_VAR NAME=SCRIPT_URL>?__mode=reset_log&magic_token=<TMPL_VAR NAME=MAGIC_TOKEN>"><MT_TRANS phrase="Reset Activity Log"></a><br />
<MT_TRANS phrase="System activity, logins"> - <MT_TRANS phrase="Reset Activity Log"></div>

Comment Spam

In the fight against comment spam, people are linking the phrase Online Poker to the relevant wikipedia page. This aims to push the spammers off the top spot. Currently the wiki is at number 3

Whilst I'm happy to stick it to the spammers, I'm in two minds about this. Firstly it could mean that the spam increases to try and compensate (though on many blogs they're already in the filters), secondly the spammer could easily edit the wiki page itself - that's what wikis are for. Although as I understand it the wiki maintainers can take steps to monitor and prevent this 'sticking'.

Ah well, let's give it a go.