You are here: Home >> How-Tos >> Getting the Most Out of the WebOutline Macro

How-To: Getting the Most Out of the WebOutline Macro

By Brian Carnell

This is a little technique I've fleshed out and added to my sites the past few weeks to sort of get the best of both worlds out of the weboutline macro.

I tend to take pretty much everything I put on my weblog and bind them to sequential URLs in directories sorted by year. So for example, I'll have a directory called "articles" and then underneath that subdirectories called "1999," "2000," etc. Then the articles are given sequential number like "000001.html," "000002.html," etc.

What I had been doing in the past was creating a message that I would bind to "2000/index.html" that simply contained a weboutline macro that would list all of the files in that directory in reverse chronological order (the news articles were on top, the oldest at the bottom of the page).

The problem I ran into was that even setting the cache to 24 hours, once you get 150-300 articles in a directory, it starts to take a significant amount of time to build the weboutline. As a result, it became pretty obvious that people simply weren't using those pages very often.

I use this same technique, btw, to produce subject-related FAQs, where I have a subdirectory called FAQ and then below that subdirectories like "People," "Places," etc. and I'd have an index.html page at the top level which would be a few weboutline macros that would go through each of those directories. Same problem -- once you get a lot of files, it can take quite a bit of time to traverse everything.

On the other hand, I definitely did *not* want to even think about going back to building and updating those pages by hand. The solution hit me smack in the face.

For each of these directories, I created a new message and bound it to a URL called "index_dynamic.html" in which I put the weboutline macro and changed the cache value to false. Then I loaded that page, did a view source, and copied the outline portion and then pasted it into the "index.html" page.

Then at the bottom of that message, I added a conditional macro like this,

<!--#if condition="userisconvadmin"-->
<p align="center"><b><a href="http://www.animalrights.net/articles/2001/index_dynamic.html">Dynamic Version of This Page</a></b></p>
<!--#endif-->

So, when I view this page, I always see a link that can take me immediately to the dynamic version of the page so I can update the contents.

On the one hand, this is still a bit more work than simply using a weboutline macro. But especially for content that is now relatively static -- obviously I'm not going to write anymore articles for 2001 until Seth builds me a time machine -- this gives the best of both worlds with very fast load times for the index page (2 seconds or so compared to 10 to 15), while at the same time making it easy for me to quickly generate a new version if I go through and edit the subject lines or add descriptions, etc.


QuickStart
Main Menu
Discussion

Guests
Welcome!
  • Sign Up
  • Logon

  • Search


    This site managed with Conversant, © Copyright 2008 Macrobyte Resources; Unless otherwise stated, content © 2000 - 2005 Mark Morgan
    Site design adapted from a free template at Free Site Templates.