Skip to content

Instantly share code, notes, and snippets.

@bryanburgers
Last active August 29, 2015 14:09
Show Gist options
  • Save bryanburgers/212ac7b65bffd2fa3f16 to your computer and use it in GitHub Desktop.
Save bryanburgers/212ac7b65bffd2fa3f16 to your computer and use it in GitHub Desktop.
I wish I had more control over Structure output
<!-- Basic output -->
<ul>
{exp:structure_output:nav depth="2"}
<li class="{if struct:first}first{/if} {if struct:last}last{/if} {if struct:here}here{/if} {if struct:parent_here}parent-here{/if}">
<a href="{struct:url}">{struct:title}</a>
{if struct:children:count}
<ul>
{struct:children}
</ul>
{/if}
</li>
{/exp:structure_output:nav}
</ul>
<!-- Classes got verbose. Simplify them? -->
<ul>
{exp:structure_output:nav depth="2"}
<li class="{struct:classes}">
<a href="{struct:url}">{struct:title}</a>
{if struct:children:count}
<ul>
{struct:children}
</ul>
{/if}
</li>
{/exp:structure_output:nav}
</ul>
<!-- Custom fields -->
<ul>
{exp:structure_output:nav depth="2"}
<li class="{struct:classes}">
{if struct:channel == 'external'}
<!-- Use a custom field -->
<a href="{struct:external_url}" rel="external">{struct:title}</a>
{if:elseif struct:channel == 'something'}
<!-- Use a custom field -->
<a href="{struct:url}"><img src="{struct:something_img}"></a>
{if:else}
<a href="{struct:url}">{struct:title}</a>
{/if}
{if struct:children:count}
<ul>
{struct:children}
</ul>
{/if}
</li>
{/exp:structure_output:nav}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment