Passing parameters to inclusion in Liquid templates

前端 未结 4 766
抹茶落季
抹茶落季 2021-01-30 12:49

On my Jekyll-powered website I have an inclusion that does something function-like, but I can\'t figure out how to pass it parameters correctly.

When I use {% incl

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-30 13:22

    Alongside David Hutchison's, there is a third solution:

    Using assign

    {% assign foo = baz.quux %}
    {% include function.liquid %}
    

    Now you can reference {{ foo }} in your included file.

提交回复
热议问题