Simon Willison’s Weblog


Date-centric vs Entry-centric

25th March 2003

When I started this blog, I made the decision to use days rather than entries as the principle navigation unit of the site. Each day’s entries are grouped under a single heading for that day, archives are arranged by day (with permalinks linking to anchors on those pages) and individual entries come without titles, to emphasise the fact that they are part of a larger whole.

It seemed like a good idea at the time but with hindsight, it was a mistake. The first signs of trouble came when I switched the comments system over to displaying comments on a full page rather than using popup windows. I chose to do this both for accessibility reasons and because I just didn’t like them. This meant introducing a new “view” to my blog which displayed an entry and its associated comments (and pingbacks as well). This worked fine, but the lack of titles on entries meant the resulting page lacked an identifier at the top. It also meant that there were two potential permalinks for every piece of content—the “official” permalink in the context of the day the entry was posted and the permalink to the entry and its comments on a separate page.

That much I could live with, although as time went by the lack of entry titles became a constant thorn (I’ve had several complaints that the lack of titles in my RSS feed makes it useless in some aggregators). The real problems emerged over the past few days, when I decided to implement a referral tracking system.

My plan was to log the HTTP_REFERER request variable of any visit to an archive page on the site, then display them in the relevant place (like Mark Pilgrim used to do but without the automated validation and extract generation system). Logging referrals was easy enough, but when I tried to display them I ran in to problems. The permalinks on this site are actually a link to a specific day plus a fragment ID to identify the individual entry. Unfortunately, the browser only requests the “real” part of the URL before using the fragment ID to jump the browser screen to a specific point. The fragment ID is not included in the request, so as far as my server is controlled the request was for the whole day page.

My solution is highly inelegant and features some of the hackiest PHP I’ve written in a long time. Instead of displaying referrals on the page they link to, I’ve put together a last 50 referrals script which displays the last 50 inbound links along with a list of shortened entries (if the link was to a day page) or the first 120 characters of an entry (if the link was to an actual entry page). It works, and it means I can get a much better idea of who is linking to me, but the code leaves a pretty bitter taste in my mouth.

Hopefully I’ll get a chance to do some pretty major rearchitecting of this blog over the Easter break. I want to move to an entry-centric design where the date of an entry is less prominent and the entry title is on prominent display. Permalinks will go to entry pages (although I will make sure older links continue to work) and I may even finally implement the search engine I’ve been promising myself for so long (the lack of titles on entries is one of the main things putting me off writing one).

This is Date-centric vs Entry-centric by Simon Willison, posted on 25th March 2003.

Next: getElementsBySelector()

Previous: Freshly Blogrolled

Previously hosted at