Movable Type continues to impress me with its flexibility and power. Last week I decided I’d had it up to here with maintaining the list of links that appears on the right side of my home page (the “blogroll,” as some people call it). Instead of manually editing HTML code in my weblog template, why not use MT to auto-generate a list of links, then use PHP to include this link list anywhere I needed it? Better still: MT’s categories feature would make it easy to group related links together.
You can see the results of this solution in my new “RESOURCES” list, on the right side of the Tweney Report home page.
Other people have probably found this solution themselves, but I’m posting it here in case it’s useful to anyone else.
How it works: I set up a new weblog called “quicklinks.” I entered each link into this new weblog as an entry, using MT’s fields as follows:
Title — the link’s title
Entry Body — the main URL for that link
Extended Entry — the corresponding RSS feed, if I could find it
Excerpt — a short, optional summary
I also assigned a category to each link: tech news, tech blogs, bookish sites, search tools, and so forth.
Then I created a new index template with the filename include.html. Here’s the complete code of that template:
<MTEntries sort_by=”title” sort_order=”ascend”>
<li><a title=”<$MTEntryExcerpt$>” href=”<$MTEntryBody convert_breaks=”0″$>”><$MTEntryTitle$></a><MTEntryIfExtended> | <a title=”XML-RSS feed” href=”<$MTEntryMore convert_breaks=”0″$>”>RSS</a></MTEntryIfExtended></li>
What this template does is spit out all of the “Quicklinks” entries, grouped by category, and ordered alphabetically within each category. Each entry appears as its name, hyperlinked to the main URL, with a link title that shows the site summary, if I entered one. If I entered a URL for the RSS feed, that shows up as an additional link. (Note: Entries that aren’t assigned to any category at all won’t show up in this list, and entries that are assigned to multiple categories should show up under each category they’ve been assigned to.)
I then published the Quicklinks blog and went back to my main weblog, the Tweney Report. Here I entered the following snippet of code into my main index template (a PHP file):
<?php include(“https://dylan.tweney.com/links/include.html”); ?>
This line uses PHP to bring in the “include.html” file created by the quicklinks blog.