Structure Navigation with 3 possible Link Types using Nav tag I'd like to build a Structure that can be used to output the main site navigation; each &quot;entry&quot; in the Structure would have three custom fields (types): Category, Entries, URL
This question is close to what I want, except it's not using Nav; I want children, so I think I need Nav? Plus I couldn't get that code to work anyway.
Based on other questions and the docs, I have this:
{% set pages = craft.entries.section('navDropDownMenu').all() %}
&lt;ul&gt;
    {% nav page in pages %}
        &lt;li&gt;
            {% if page.entriesFieldLink %}
                &lt;a href=&quot;{{ page.entriesFieldLink.first().url|default }}&quot;&gt;{{ page.title }}&lt;/a&gt;
            {% elseif page.urlFieldLink %}
                &lt;a href=&quot;{{{{ page.urlFieldLink.first().url|default }}&quot;&gt;{{ page.title }}&lt;/a&gt;
            {% else %}
                &lt;a href=&quot;{{ page.category.url }}&quot;&gt;{{ page.title }}&lt;/a&gt;
         {% endif %}
            {% ifchildren %}
                &lt;ul&gt;
                    {% children %}
                &lt;/ul&gt;
            {% endifchildren %}
        &lt;/li&gt;
    {% endnav %}
&lt;/ul&gt;

The only thing that works here is the Category link, except it should be a child but it isn't. I'm new to Craft so I'm probably doing something basic wrong, but any help is appreciated.
I am doing something similar in using a Structure for the main navigation.  Below is what I have.  Hope it helps!
{% set menu = craft.entries.section('navMain').all() %}
&lt;ul&gt; 
{% nav link in menu %}
    &lt;li&gt;
    {% if link.menuEntry|length %}
        {% if craft.app.request.absoluteUrl ==  link.menuEntry[0].url %}
        &lt;a href=&quot;{{ link.menuEntry[0].url }}&quot; class=&quot;active&quot;&gt;{{ link.title }}&lt;/a&gt;
        {% else %}
            &lt;a href=&quot;{{ link.menuEntry[0].url }}&quot;&gt;{{ link.title }}&lt;/a&gt;
         {% endif %}
    {% else %}
        {% if craft.app.request.absoluteUrl ==  link.menuCustomURL %}
            &lt;a href=&quot;{{ link.menuCustomURL }}&quot; class=&quot;active&quot;&gt;{{ link.title }}&lt;/a&gt;
        {% else %}
            &lt;a href=&quot;{{ link.menuCustomURL }}&quot;&gt;{{ link.title }}&lt;/a&gt;
        {% endif %}
    {% endif %}
    {% ifchildren %}
        &lt;ul&gt;
            {% children %}
        &lt;/ul&gt;
    {% endifchildren %}
    &lt;/li&gt; 
{% endnav %}
&lt;/ul&gt;