[%- WRAPPER site_wrapper.html title = 'Sections' -%] [%- SET p = c.req.query_params count = 0 -%] [% BLOCK list_subsections %] [%- SET p.parent_id = this_section_id result = list_sections( p ) sections = result.rows -%] [% IF result.total > 0 %]

[% IF this_section_id == 'none' %] [% SET posts_result = list_posts( limit => 1, section_id => 'none' ) %] [% IF posts_result.total > 0 %]
- unsectioned ([% posts_result.total %] posts)
[% END %] [% END %] [% FOREACH section IN sections %] [% SET count = count + 1 %]
- [% IF section.posts_count > 0 %] [% section.name %] [% ELSE %] [% section.name %] [% END %] ([% section.posts_count %] posts) [% PROCESS list_subsections this_section_id = section.id %]
[% END %]

[% END %] [% END %]
[% PROCESS list_subsections this_section_id = 'none' %]
[% count %] total sections
[% END %]