Skip to content

Conversation

@ryanmitchell
Copy link
Contributor

This PR adds support for as as a parameter on nav tags, so you can do things like

{{ nav:main as="navnav" }} 
    {{ navnav | chunk(3) }}
        chunk
    {{ /navnav }}
{{ /nav:main }}

@jasonvarga
Copy link
Member

Recursion doesn't work with this though. 🤔 I'm talking about this sort of stuff:

<ul>
{{ nav:main }}
    <li>
        {{ title }}
        {{ if children }}
            <ul>{{ *recursive children* }}</ul>
        {{ /if }}
    </li>
{{ /nav:main }}
</ul>

@ryanmitchell
Copy link
Contributor Author

Yeah you lose that ability when you 'as' it... I can live with that?

@jasonvarga
Copy link
Member

Me too I think. We could always fix it later. We'll just document the caveat.

@jasonvarga jasonvarga merged commit a691c1e into statamic:5.x Mar 3, 2025
24 checks passed
@ryanmitchell ryanmitchell deleted the feature/as-on-nav-tag branch March 3, 2025 15:30
@edalzell
Copy link
Contributor

edalzell commented Mar 3, 2025

does it support navnavnavnav?

@ryanmitchell
Copy link
Contributor Author

I'd prefer nanananananananav

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants