a links database with MT

Inspired by recent articles on how to use Movable Type for more than just blogs, I’ve been trying this out on more areas of the site. The news, articles and album cover playlist sections are MT powered, and now the links database is too. This means I can now add content to the site from either the web or from my weblog editor in NetNewsWire.

The technique has been well documented on many blogs, (wholelottanothing’s is very well written) so I’ll skimp a bit. First I created a new blog called ‘links’ and removed templates I wouldn’t need (such as the stylesheets and individual entry archives). I also set archiving to ‘category’ and turned comments and convert line breaks off. Then I decided which MT tags to use for which piece of data:

  • MTCategories - the link category

  • MTEntryTitle - Website name

  • MTEntryKeywords - the URL

  • MTEntryBody - site description

I inserted these tags into the main MT Template:

    <h3><$MTCategoryLabel$> (<$MTCategoryCount$>)</h3>
      <MTEntries lastn="100" sort_by="title" sort_order="ascend">
        <p><a href="<$MTEntryKeywords$>" title="visit <$MTEntryTitle$>">
          <$MTEntryTitle$></a> // <$MTEntryBody$></p>

This then creates a page, listing all the links within their categories. The tags in the category archives page (where just one category of links is shown) needs to be slightly different:

<h3><$MTArchiveTitle$> (<$MTArchiveCount$>)</h3>
      <MTEntries lastn="100" sort_by="title" sort_order="ascend">
        <p><a href="<$MTEntryKeywords$>" title="visit <$MTEntryTitle$>">
        <$MTEntryTitle$></a> // <$MTEntryBody$></p>

To get the links to display in alphabetical order, add sort_by=“title” sort_order=“ascend” to the MTEntries tag. I used


Call Jon Hicks on +44 (0)7917 391536
Tweet @hicksdesign

Hicks Design
Hexagon House
Avenue 4, Station Lane
Witney, OX28 4BN
United Kingdom