A couple of weeks ago, I started rolling out a new site design. I still haven't finished. Monthly and category archives, specifically, are still using the old design. Not a big deal, but I'll get to them.

In the meantime, I had come across what I saw as a problem on offering virtual feeds. For those who don't recall (or didn't see), a virtual feed is created by performing a search and choosing the "syndicate results" checkbox. This produces an RSS 2.0-compliant feed of your search. I use an offshoot of this to produce the per-entry feeds, complete with comments, for your subscription pleasure.

The problem is that beacuse these are not files per se, they had no modification date. Each time the search was run, the entire results were returned as if they had never been run before. This could cause a significant increase in bandwidth as each run of the search sent the entire results. Normally, if a file is being retrieved, the retriever (browser, crawler, whatever) checks the Last-Modified header to see if the page has changed. Not possible if you're creating search results dynamically.

Or so I thought. Yesterday, I finally made a breakthrough on my hacking of the Movable Type search function (found in Search.pm) that allows me to send a Last-Modified date on most search results. The date is either the date of the last entry (if performing a standard search) or it is the date of the last comment (if using an entry feed). This allows everyone to save on bandwidth.

If no search results are found, then there is no Last-Modified header, which means the whole page is retrieved each time. Of course, if there aren't any results, it's really not that much data, so this shouldn't be a problem.

I'm still tweaking at the code a bit, but in the next 24 hours or so, I intend to post the code here on the site to show how you can add this feature to your site if you so desire. One thing this does require is Kevin Shay's most excellent UTCDate plugin for Movable Type (no longer needed/available). This is required in order to send a GMT (also called UTC) date, which is often the standard. If you don't want to send a GMT date, you should be able to modify this hack enough so that you can send whatever timezone you'd like. Stay tuned...

Comments (1)

Very nice looking design! Is your desk as well organized? I can't figure out whether people's blogs reflect the state of their desk or are the inverse. Anyway, great work!

Leave a comment