Post indexes are now up

| 9 Comments

My project for the day was adding post index pages (table of contents, recent titled posts, whatever you want to call them) to my weblog.

I decided to go with Rogers Cadenhead's viewPostIndex macro because

  1. It was something I didn't have to figure out and write myself (no need to re-invent the wheel here)

  2. The macro automatically groups posts by month

  3. Because the macro uses an unordered list to display the posts, each post has a bullet in front of it

  4. Built-in support for CSS classes

  5. Rogers has a companion macro (upstreamPostIndexes, available on the same page) that will automatically upstream the post index pages once a night.

I did end up customizing the viewPostIndex macro a bit. This is what I changed:

  • Added default CSS classes to the macro's parameters so I didn't have to use them in the macro calls on my templates.

  • Added another CSS class to format the month headings. I wanted them displayed in bold but didn't want to add <b> tags in the macro code, nor did I want to have to edit the macro every time I changed my mind on how I wanted it formatted.

  • Changed the format of the month header so that instead of displaying "2003/09" it now displays "September 2003".

  • Added the date of each post to the output (formatted as "Sep 16") and enclosed it with a <div style="float: right; margin-left: 10px;"> tag to force the date to the far right end of the line.

    Update: Internet Explorer does not display things correctly using "margin-left". It took me a while to figure that out, as well as how to fix it. I changed it to "padding-left" and now the index pages display correctly in both Internet Explorer and Mozilla Firebird.

My main weblog and all of my category pages now have a post index page. The links to them can be seen in my links column on the right. [Nice macros, Rogers - Thanks!]

Note for Rogers: In his Sept. 11 post, Rogers notes a comment about his picture: "nice picture you look like a bore brush for a 50mm.". When I saw Rogers' picture, the first word that immediately came into my mind was "engineer" - as in someone who *knows* how to build things. Enough said.

9 Comments

This is exactly what I've been trying to fix for my table of contents page and make it work correctly..how did you do it exactly?? :)

Are you wanting details on everything or something specific?

Are you willing to release this code... the whole thing all changed and stuff? *blinks* hehe =)

Well, I could but I am hesitant to do so for two reasons:

1. A couple of my hacks should be set up cleaner so it would be easier for people to customize the appearance, rather than having to tinker with the code for every adjustment.

2. It's not my code to redistibute. I feel I'd need Rogers' okay first, since it really is his code.

*nods* If you ever do release it I'll be more than happy to replace my current code *grins*

What code are you using, Lisa?

I'm using roger's code for my categories; I'm using some other long macro for the main blog - because it has dates, but it didn't work in categories... and th enightly updater doesn't hit it, which is why I want yours ;) Cos it has dates and the nightly updater thing Roger made works´┐Ż

Lisa, I e-mailed you a copy of the macro that Julie and I are using. Let me know if you receive it - I'm not sure it went out.

I got it and am using it, thank you =)