Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Support as on nav tag #11522

Merged
merged 2 commits into from
Mar 3, 2025

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