Does the render tag support with/as and for/as?
See original GitHub issueReviewing documentation for the render
tag, it appears to have a few parameters that are not supported by LiquidJS.
The with
parameter
A single object can be passed to a snippet by using the
with
andas
parameters:{% assign featured_product = all_products['product_handle'] %} {% render 'product' with featured_product as product %}
In the example above, the
product
variable in the snippet will hold the value offeatured_product
in the parent template.
In my testing, it appears that while LiquidJS supports with
, it does not support reassignment using as
.
The for
parameter
A snippet can be rendered once for each value of an enumerable object by using the
for
andas
parameters:{% assign variants = product.variants %} {% render 'variant' for variants as variant %}
In the example above, the snippet will be rendered once for each variant of the product, and the variant variable will hold a product
variant
object within the snippet.When using the
for
parameter, theforloop
object is accessible within the snippet.
In my testing, it appears that LiquidJS does not support the for
and as
parameters.
Looking at the code for render
in shopify/liquid
, it appears these are core Liquid features (i.e., they are not Shopify specific), but I could be wrong.
What is the status of these parameters?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
🎉 This issue has been resolved in version 9.10.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
Awesome, thanks @harttle – can’t wait to try this out! 🎉