Every so often, someone will post a question in Radio Userland's discussion forum about the link to the previous month or following month on their weblog's calendar being broken. This always seems to occur on main weblog pages and not category pages.
Julie (Sexy Magick) ran into this problem about a week and a half ago. She had published a post to a category on August 31, but did not publish any posts to her main weblog. This month, the "Aug" link in her main weblog calendar is broken - the link points to the daily archive for Aug. 31 even though Julie did not publish any posts to her main weblog that day.
To figure out why this was occurring, I examined the macro code involved with creating a calendar:
When drawing a calendar, the macro code needs to look at category posts only for a category weblog page calendar, and home page posts only for a main weblog page calendar. The macro code for categories appears to work correctly. However, it is impossible for the macro code for main weblog (home page) posts to work correctly.
In order for these macro to correctly identify home page posts, the macros must look at the flNotOnHomePage field for each post. The getLastPostBeforeDate macro, the getNextPostAfterDate macro, and the code in the drawCalendar macro that creates the previous and next month links do not look at the flNotOnHomePage field at all. Posts that have been posted to a category only and not to the main weblog can be returned by these macros and used as the basis for links on the main weblog calendar when they should not be.
On the last day posts are posted in a given month, if they are all posted to categories and not to the main weblog, the link to that month on the next month's main weblog calendar (the previous month) will be broken.
Similarly, on the first day posts are posted in a given month, if they are all posted to categories and not to the main weblog, the link to that month on the previous month's main weblog calendar (the next month) will be broken.
It is extremely difficult to determine the best way to fix this bug. I do not know if the error is in the fact that getLastPostBeforeDate and getNextPostAfterDate do not look at flNotOnHomePage for home page posts, the fact that drawCalendar does not look at flNotOnHomePage, or both. Nor do I know whether or not a specific fix would break something else in Radio - other functions in Radio may depend on the getLastPostBeforeDate and getNextPostAfterDate macros functioning as they do now. For now, all I can do is report and document the bug.