We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Using a passed in partial's variable within antlers syntax

James Hall November 24, 2020 by James Hall

Hey there.

I was wondering whether it's possible to pass in a value in a partial, e.g.:

{{ partial:partials/pagination paginationValue=4 cardType='blog-card'}}.

And then use the values within antlers syntax, like so:

{{ collection:blog paginate=paginationValue as="loop" }}

{{ loop }} {{ partial:partials/:cardType }} {{ /loop }}
{{ paginate }} <div> <a href="{{ prev_page }}">← Previous</a> <a href="{{ next_page }}">Next →</a> </div> {{ /paginate }} {{ /collection:blog }}

As you can see, I'd like to pass in the variables 'paginationValue' and 'cardType'. Is there a way to do this?


Answered by Jack McDade!
>>>>>>> Answered <<<<<<<
3 Replies