Browsing the "Colophon" category...
Surrounding Articles Tridux
It was probably a case of premature optimization on my part, but my idx_article Textpattern plugin assumed that a larger article id would always be more recent than a smaller article id.
That was appropriate for most of my posts. However, my focus pages are periodically updated and the resulting sequence got a bit peculiar. I’ve updated the plugin so that the surrounding_articles tag always displays posts in chronological order.
I Need a Life
aka “I’ve got categories.”
Textpattern has both sections and categories. The difference is a bit subtle; but the upshot was that Take the First Step was only using sections for Technology and Sports out of the chute.
That’s changed. Categories are up and I tweaked the templates to include a category list. Since that is presentation rather than content, any curious subscribers should make a real visit to check it out.
And then I burnt the better part of two hours adding categories to old posts in the Sports section. I really need to get a life.
Textpattern and custom_url_func
One of my biggest concerns in moving from Radio Userland to Textpattern was preserving inbound links. My initial approach used mod_rewrite and year-month-day mode. This was fairly effective.
But I wasn't completely satisfied. Year-month-day mode is based upon GMT, moving posts after 7pm moved into the next day. And it never really felt like a good long-term solution.
I didn't want to wait for the ideal solution, so I added an id based RewriteRule, created index pages using the newly defined id based links, and started a project to update all my internal links. This allowed me move all my content from Radio Userland to Textpattern.
Now, my only problem was that Take the First Step was using two url modes: year-month-day for Textpattern generated links and my id mode for manually generated links in my content.
The final piece of my solution was “custom_url_func”. I added a plugin that codified my id mode as a “custom_url_func”, and unified all my internal links into a single mode. The entire solution looks like this:
- mod_rewrite and year-month-day mode to preserve old inbound links.
- more mod_rewrite to handle an alternate link mode of id/NNNN/url-title. The new rules simply extract the post id from the link and pass it on as part of the query string.
RewriteRule ^id/([0-9]+)/?$ index.php?id=$1 [L] RewriteRule ^id/([0-9]+)/[^/]+$ index.php?id=$1 [L] - A custom_url_func plugin to specify an alternate link format for all Textpattern generated article links. The business end of the plugin follows:
function idx_permlinkurl($article_array) { global $prefs;
if (empty($article_array)) return; extract($article_array);
if (!isset($title)) $title = $Title; if (empty($url_title)) $url_title = stripSpace($title); if (empty($thisid)) $thisid = $ID;
if ($prefs['attach_titles_to_permalinks']) { return hu."id/$thisid/$url_title"; } else { return hu."id/$thisid/"; } }
$prefs['custom_url_func'] = 'idx_permlinkurl';
Index Pages in Textpattern
Java Tutorials are the big draw here at Take the First Step. The easy way to build my new tutorial landing pages would have been via a Textpattern category. But I wanted too much control over both the content and the presentation to go that route. My method was to:
- Create a section dedicated to focus pages. I elected to keep my focus posts off the front page and out of my syndication feeds – YMMV.
- Hand roll each summary page as a focus section post. This allowed me to simply copy my existing focus pages (implemented as tables, text paragraphs, and definition lists) into Textpattern.
- Control presentation with a focus template page. My focus template is very similar to my main template – I simply tweaked my Surrounding Articles plugin so that I could optionally limit the article list to a specific section.
- Clean urls with some htaccess magic. Because I have a small number of focus pages, I map focus/java, focus/cms, and focus/weblog to index.php?id=NNNN (where NNNN is the appropriate id number for each focus page).
It was a bit more work, but I’m pretty happy with the result. It doesn’t really scale, but I only expect small numbers (only three at present).
Feed Updates
I really need to pay more attention to my log files. I have been monitoring for 404 “file not found” response codes to detect any fallout from my .htaccess frenzy from a few weeks ago.
But I haven’t been looking for anything else. Until tonight – when I realized that I haven’t checked my feed subscription levels in quite a while. And I was even more surprised when I realized that I had neglected to redirect all of my old Radio Userland feeds to their new Textpattern equivalents.
So I added some more htaccess redirects, I claimed some more feeds in Bloglines and I think that all my old feeds are back in business.
Site Renovation
There is a certain appeal to a simple white web page with text. But it was time to liven the joint up. Not finding a suitable image of my own, I started searching at iStockphoto.
A bit of rotating and cropping and Take the First Step has a new header graphic.
Surrounding Articles Redux
As I said before:
Out of the box, TextPattern doesn’t provide a calendar view. I don’t think that I will miss it. I’ve always felt a bit of calendar pressure – sometimes delaying articles to light up the calendar rather than posting when the idea is fresh. But I’ve always kept it because I didn’t have a good alternative.
My proposed alternative then was to add a list of recent articles to the sidebar. With a twist – when looking at an article from the past, the article list contains articles that were posted immediately before and after that post. This allows the reader to easily browse the blog chronologically.
Well, I’ve finally got around to bringing that concept up to date with version 4.03 of Textpattern. My idx_article plugin is now available for download. It has also been enhanced to list articles before and after the requested day in year-month-day-title permalink mode.
15 Oct: Surrounding Articles Tridux