Output structure in a Given a structure that has, for example, three levels of content—how do I just iterate over it and create a nested &lt;ul&gt; reflecting the hierarchy and containing the title and slug (as a link) of each entry?

The following just gives me a flat representation of the structure:

&lt;div class="panel"&gt;
    &lt;h2&gt;People&lt;/h2&gt;
    &lt;ul&gt;
        {% for entry in craft.entries.section('people') %}
            &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
        {% endfor %}
    &lt;/ul&gt;
&lt;/div&gt;
This could be achieved through a recursive macro:

{% macro recursive_nav(entries, depth) %}
{% import _self as self %}
&lt;ul&gt;
    {% for e in entries %}
        &lt;li&gt;
            &lt;a href="{{ e.url }}"&gt;{{ e.title }}&lt;/a&gt;
            {% if e.hasDescendants() %}
                {{ self.recursive_nav(e.children, depth+1) }}
            {% endif %}
        &lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;
{% endmacro %}


And then to use it in your template:

{% import '_macros/recursive-nav.twig' as rn %}
{% set entry = craft.entries.section('people').level(1) %}
&lt;div class="panel"&gt;
    &lt;h2&gt;People&lt;/h2&gt;
    {{ rn.recursive_nav(entry, 1) }}
&lt;/div&gt;


This was borrowed and slightly modified from Marion's answer here. That question is also a great resource for other ways to achieve this result.