Last active
August 29, 2015 14:03
-
-
Save mildlygeeky/6f8eeb28a10240cde5a0 to your computer and use it in GitHub Desktop.
Generating a menu for Matrix blocks in Craft CMS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for block in entry.bodyBlocks %} | |
{%- if loop.first %}<ul>{% endif %} | |
<li><a href="#bodyblock-{{ block.ownerId }}-{{ block.id }}">{{ block.blockName }}</a></li> | |
{%- if loop.first %}</ul>{% endif %} | |
{%- endfor %} | |
{%- for block in entry.bodyBlocks %} | |
<div class="hidden" id="#bodyblock-{{ block.ownerId }}-{{ block.id }}"></div> | |
{{- block.blockBody }} | |
{%- endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment