--- var: true --- {% assign some_bool = false %} ## Simple capture hi → {% capture var1 %}hi{% endcapture %}{{ var1 }} ## Conditional capture '' → '{% capture var2 unless true %}hi{% endcapture %}{{ var2 }}' hi → {% capture var3 if true %}hi{% endcapture %}{{ var3 }} '' → '{% capture var4 if some_bool %}hi{% endcapture %}{{ var4 }}' hi → {% capture var3 ||= %}nooooo{% endcapture %}{{ var3 }} hi → {% capture varz ||= %}hi{% endcapture %}{{ varz }} ## Additive capture hihi → {% capture var3 += if true %}hi{% endcapture %}{{ var3 }} ## Complex capture hi → {% capture var8 if false or page.var %}hi{% endcapture %}{{ var8 }} um, hi → {% capture var9 if false or page.var %} {% assign var10 = 'hi' %} um, {{ var10 }} {% endcapture %}{{ var9 }} ## Test filters FOO BAR BAZ BOOGA → {% capture filters | upcase %} foo bar baz booga {% endcapture %}{{ filters }}