i mentioned this to Dave recently and we both thought the idea merited a bit more discussion so i am bringing it up here.

i've been wavering back and forth for quite some time on the way our weblog templates are setup, meaning how we use Weblog, _day, etc, and what we have now works, but i've often felt that merging the Weblog and _day templates into a single template would actually be a nicer approach.

i think it's a bit easier on template writers to not have to switch back and forth between the 2 templates to understand how the page will be rendered and that really complex showEntriesInCategory() macro which handles the entry display logic for collection views, permalinks, and search results is a bit over the top.

this is just a thought, but if i had it to do from the ground up i think i would try replacing the Weblog and _day templates that we have now with 3 separate templates ... Weblog, Permalink, and SearchResults. In my mind there is enough of a reason to design each of these views a little bit differently that this makes sense. i also know that this is how MT does it and i would say that i find their templating process a bit nicer than ours.

there aren't any plans to implement this right now, but it's something to think about. at some point it no longer makes sense to try and make the Weblog and _day templates fit the bill for all types of weblog page views, and I feel like that's the path we are headed down right now. To me it makes a little more sense to separate pages out into their own templates because they are easier to work on that way.

to add a little bit more technical info to this so that it's clear, i am basically suggesting that each weblog should have 3 required templates which replace the current Weblog and _day templates ...

Weblog - displays entry collection views like homepage and date/category pages.

Permalink - pretty obvious.

SearchResults - page for showing search results.


In each of these templates you would provide the complete code for rendering the page, so you wouldn't be calling a macro like #displayWeblogEntries() which does the logic of determining what kind of view to render and then properly iterating over the entries and including the _day template over and over again. Instead you would use a couple of simple lines like this ...

#set(entriesByDay = $model.entries)
#foreach($day in $entriesByDay.keySet())

  ... put your single day display logic ...

#end

permalinks and search results would work a bid differently obviously because when you are editing the template you know exactly what to expect, so you are working with different data but in a similar fashion.

thoughts? opinions? the basic goal is to simplify the template editing process to make it easier for users to understand and i think this approach is a little bit more flexible and still easier for users to grasp than the combination of the Weblog and _day templates.

-- Allen

Reply via email to