On Monday, I finally devised a sane set of Tinderbox Agents for properly posting to this front page. I had a number of needs:
- Show no more than (n) number of latest posts
- Show only posts from the last week
Sure, I could have written an agent that looked like this:
But that was my original approach, and it didn't let me write posts into the future. So I modified it, and for a time, it looked like this:
But this had problems as well. What happened if I wrote six days in advance? Nothing would show up on the main page. So I tried the following combination:
But this wouldn't let me limit the number of items it would show on the front page. I finally came up with the solution I needed by creating an intermediary Agent. This agent, called Post Week, uses the following query:
Then, the agent that builds the main page uses the following agent code:
The RSS feed agent also uses the same code.
The moral of the story? If you can't quite do it in one line of logic, try to tie things together. Sometimes, you can do really cool things with multiple Tinderbox agents pulling off each other.