Skip to content

Instantly share code, notes, and snippets.

@bryanburgers
Created May 14, 2015 02:30
Show Gist options
  • Save bryanburgers/8ae61d1068cb109fc6f8 to your computer and use it in GitHub Desktop.
Save bryanburgers/8ae61d1068cb109fc6f8 to your computer and use it in GitHub Desktop.
Group adjacent blocks of the same type together.
{!--
> Awesome. Just had an Ah-ha! moment. Build small blocks, then add
> multiple Block fields to a channel with specific blocks in.
-- @JayHealy, https://twitter.com/JayHealey/status/598668322301837312
--}
{cf_page_content}
... {!-- other block types --}
{b_faq}
{!-- If the previous block isn't a FAQ, we're starting
a new group of FAQs, so open the list. --}
{if "{blocks:previous:shortname}" != "b_faq"}
<ul class="faqs">
{/if}
<li class="faq">
<div class="faq-q">{a_question}</div>
<div class="faq-a">{a_answer}</div>
</li>
{!-- If the next block isn't a FAQ, we're ending a group
of FAQs, so close the list. --}
{if "{blocks:next:shortname}" != "b_faq"}
</ul>
{/if}
{/b_faq}
... {!-- other block types --}
{/cf_page_content}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment