I'm using Stash lists to output channel entries grouped by the value of a custom field. In this case the custom field is a relationship field, but that's not relevant because the actual entries output is working just fine. What is giving me problems is using the {count} variable to apply a heading to each group of entries. Here's my code (for simplicity I've removed most of the variables that I'm stashing and just including the 'reviewtext' one).
<!-- STASH variables -->
{exp:channel:entries channel="reviews" disable="categories|member_data|pagination" show_expired="yes" cache="yes" refresh="10"}
{exp:stash:append_list name="entries" context="{reviews_assigned_project:channel_short_name}" parse_conditionals="yes"}
{stash:reviewtext}{reviews_review}{/stash:reviewtext}
{/exp:stash:append_list}
{/exp:channel:entries}
<!-- book reviews -->
{exp:stash:get_list name="entries" context="books" process="end"}
{if {count} == 1}
<h2>Book reviews</h2>
{/if}
<article>
{reviewtext}
{count} of {total_results}
</article>
{/exp:stash:get_list}
<!-- comic reviews -->
{exp:stash:get_list name="entries" context="comics" process="end"}
{if {count} == 1}
<h2>Comic book reviews</h2>
{/if}
<article>
{reviewtext}
{count} of {total_results}
</article>
{/exp:stash:get_list}
The output is fine apart from the conditional, which is output verbatim, with the exception that the value of {count} is parsed into the page. So, when I have three book reviews and two comic reviews, I get the following:
<!-- book reviews -->
{if 1 == 1}
<h2>Book reviews</h2>
{/if}
<article>
... my entry content ...
1 of 3
</article>
{if 2 == 1}
<h2>Book reviews</h2>
{/if}
<article>
... my entry content ...
2 of 3
</article>
{if 3 == 1}
<h2>Book reviews</h2>
{/if}
<article>
... my entry content ...
3 of 3
</article>
<!-- comic reviews -->
{if 1 == 1}
<h2>Comic book reviews</h2>
{/if}
<article>
... my entry content ...
1 of 2
</article>
{if 2 == 1}
<h2>Comic book reviews</h2>
{/if}
<article>
... my entry content ...
2 of 2
</article>
I've tried wrapping the conditional in exp:ifelse tags, and I've tried using Switchee instead of the {if} conditional. In every case the conditional tags (of whatever sort, including the ifelse and switchee tags) are output as template code. I tried stashing the count as a variable but that gives me the count from the entire channel entries tag rather than the count of the list output - so my book reviews have counts of 1, 3 and 4, whilst my comic reviews have counts of 2 and 5. Not what I'm after.
What am I doing wrong and how can I get the stash:list's count to work in the conditional statement? Thanks.