I changed the way the monthly archive links are generated again. I scrapped using links in an opml file and decided to try to write a macro to automatically generate the proper links. I searched high and low on Radio Userland's forums for a macro to do what I wanted, but didn't find any. All I found were other people's requests for such a macro that went unanswered.
Designing and writing the macro was hard. Figuring out the proper approach, how to hook into existing Radio Userland routines, whether the address or value of a variable is needed, the actual commands needed and their syntax, trying to cover all of the "what if the macro runs into something bad or unexpected" scenarios - all of this and more took a lot of time. I think it is safe to say that it is not perfect, but it works and does everything I want it to do right now.
Here's a summary of what my new macro does:
Calculates the proper starting month/year (uses posted date of 1st post in blog) and ending month (uses current month/year) for the archive links automatically. Calculates the possibility of an archive link for each and every month in between.
If the web page is a category page, the macro calculates monthly archive links to the category archives and not the main blog's.
For each month in the archive list, the blog is checked to see if a post was actually made in that month. If a post is present, a link is created to the archive. If there are no posts for that month, the plain text of the month/year appears with no link (which should make it display in a different color as well). For category pages, this check is made by determining if a post in that category was made for that month.
If the web page is being upstreamed (being FTP'd to a web server), full URLs for the archive links are provided so the links will work on any page of the blog, whether it's the home page, a category page, an archive page, or any other page.
If the web page is dynamic (served locally on Radio Userland's Desktop Website), relative links starting at / are provided for the archive links. Category pages on the Desktop Website are given relative links to the local category archive pages.
I was tempted to post the code of the macro here, but I think I may tweak it a little more first. These are some of the things I feel need to be looked at:
If I correctly understand one of the Radio Userland macro calls I used, it assumes that every post created is posted to the main blog. This is probably a safe assumption for most users, but I can think of at least 1 case where this assumption is not valid and I'm not sure how the macro would handle that case.
I am not confident that if a category is being upstreamed to a different server than the main blog that the code would still work correctly.
The checking I do to ensure I'm working with a valid category seems excessive, which makes me wonder if I'm checking it correctly.
I need to apply a CSS class to the "a href" tags the macro generates.
I think it would be a good idea if the macro could accept starting and ending dates to calculate the month/year list of archive links for. This would be useful to generate archive links only for the current year, for example.
Regardless of whether I post the code here, I probably should post it over at Radio Userland when I'm a little more comfortable with it. More Radio Userland users are likely to see it that way.