Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Is this template possible in CityScript?

I'm trying to do monthly archives of posts, and this CityScript template doesn't seem to work:

    {$ foreach post
        in (and (folder "daily") (monthOf  .filedDate ))
        sortAscendBy .filedDate $}

Actually, looking at it, I can see some ambiguity, in that .filedDate is referring both to the date of the posts and the date of the article to which the template is applied.

If I hard-code the (monthOf 2003/08/01) part, then I will need a more complex template or article for each month...

How do you guys do monthly archives?

Colin Nicholls
Thursday, August 28, 2003

OK, stupid me, I've searched on "archive" and found some pointers. Still no good way to do this in 2.0?

Colin Nicholls
Thursday, August 28, 2003

The way I'm doing it is

{$ foreach newsStory in (and (folder "news") (monthOf 2003/6/1)) sortAscendBy .filedDate $}

that's for, say, June 2003. It totally sucks and I have to remember to create new archives every month, which I don't remember.

We tried to implement a feature to make archives better in version 2.0 but the design of the feature was complicated and sucked, so we were too embarassed to document it. It's still a priority.

Joel Spolsky
Friday, August 29, 2003

I just thought of something: I'm going to spend a few minutes and precreate archive articles for the next three years, then set their "never publish before" dates, so the archive will be pretty much automatic.

Joel Spolsky
Friday, August 29, 2003

That's what I did, though I only bothered with 2003 for now. Seeing as I have changed my site design about 115 times since I installed CD a week about two weeks ago I didn't want to generate too much work for the next time, if it comes.

The only downside with this is of course that the archive page might be published before any articles in that month are added, but that's not a big problem. I only tend to publish when I write something new anyway, and I hope I don't keep updating things as often as I have :)

Lasse Vågsæther Karlsen
Friday, August 29, 2003

Lasse, I used the "never publish before" feature to insure that archive pages are not published until there's something in them. I set it up last night for the next full year of Joel on Software; it took about 10 minutes and now I can forget about it. (And hopefully within a year we'll have time to do a nice autoarchive feature.)

Joel Spolsky
Friday, August 29, 2003

I've got a system working now that, like the rest of you, requires creating archive pages manually with VERY SIMILAR contents (only the date is different).

CityDesk is so great that I can forgive this necessary hack, and I look forward to automatic archiving in the future. After trying some nested template script tricks, I can appreciate that to do this right might require some engine changes.

Enjoying 2.0, anticipating 3.0,
- colin

Colin M Nicholls
Friday, August 29, 2003

Joel and Lasse: Excellent, set up all the archive files at once. I create a new archive file each month.

But it leads to messy CityScript Buildup: Scripts that served their purpose for a while but now, never change. Every year, 12 more scripts.

In my case, when the month is over, I don't need the archive script any more. So I've taken to previewing the archive page, copying it, and pasting it back over my archive script. The one problem is that the preview removes the magic names. If one of my archived daily aritlcles links to a picture within the site, and I reorganize my pictures a little - broken link.

tk
Friday, August 29, 2003

*  Recent Topics

*  Fog Creek Home