Log in
Log into community
Welcome to the Liquify Community
New post
View all posts
Related posts
Did this answer your question?
๐
๐
๐
Powered by
Hall
Active
Updated 7 days ago
0
Follow
How do I wrap a for statement in an assign statement?
How do I wrap a for statement in an assign statement?
Active
0
Follow
L
Levi Benton
7 days ago
ยท
Would I need another div or would ':inside' work? I am going for
{% assign limit = 3 %}
{% assign counter = 0 %}
{% for article in blogs['Release'].articles %}
{% if counter < limit %}
{% if article.image %}
J
L
2 comments
Share
Open in Discord
J
Jan
7 days ago
Hey Levi, you could do something like this:
<div li-tag="assign limit = 3"></div>
<div li-tag="assign counter = 0"></div>
<div li-for:inside="article in blogs['Release'].articles">
<div li-if="counter < limit and article.image">
Content
</div>
</div>
The li-tag divs will be removed during the conversion, so at the end you will only have the HTML content you actually need :)
L
Levi Benton
7 days ago
Oh this is great! Thank you!
Add a reply
Sign up and join the conversation on Discord
Join on Discord