Preface
I'm new to Statamic but not new to PHP or Laravel.
Context
I want to allow a user to insert a Navigation structure into a Bard field. I've created a Set inside the Bard field with a section_title
and the structures
limited to 1. However it seems very convoluted to display the navigation.
Question
Is this the best way to do this? I have to think there is a better way to display a navigation when you want to allow the user to pick which one it is.
{{foreach:structures}}
{{if key | contains:handle}}
<h2>{{section_title}}</h2>
<ul>
{{structure :for="value" include_home="true"}}
<li>
<a href="{{url}}">{{title}}</a>
</li>
{{if children}}
<ul>
{{children}}
<li>
<a href="{{url}}">{{title}}</a>
</li>
{{/children}}
</ul>
{{/if}}
{{/structure}}
</ul>
{{/if}}
{{/foreach:structures}}