Search code examples
c#liquiddotliquid

DotLiquid using variables inside tags


Is there any option to use variables inside tags like,

{% for product in category.products | limit: {{section.limit}} %}

I've tried using capture or assign didn't work for me. Thanks in advance..


Solution

  • Just {% for product in category.products | limit: section.limit %}

    Edit after your comment :

    The only way I cast String to Integer is :

    {% assign limit = section.limit | plus: 0 %}

    then {% for product in category.products | limit: limit %}.

    And Integer to String : {% assign str = 1 | append: "" %} => str == "1"