Tohuw
Tohuw

Reputation: 3800

Use a Variable as the Value for a Limit Expression in Liquid

I'm writing a Liquid template for Jekyll, and wish to do something like so:

{% for example in examples | limit:{{ site.examplelimit}} %}

However, this never works. {{ site.examplelimit}} returns a value, and even something more precise like preceding the above with:

{% capture examplelimitint %}site.examplelimit{% endcapture %}
{% assign examplelimitint = examplelimitint | plus:0 %}

...doesn't help.

So, is there really no way to use a variable for the value to limit in Liquid?

Upvotes: 0

Views: 261

Answers (1)

David Jacquel
David Jacquel

Reputation: 52829

You can try :

{% for example in examples | limit: site.examplelimit %}

Upvotes: 3

Related Questions