liquidjs icon indicating copy to clipboard operation
liquidjs copied to clipboard

Can't get data if use tag 'render'

Open shkarinn opened this issue 1 year ago • 2 comments
trafficstars

Hello. If I use old tag include {% include 'header/section' %} my data inside include file is working

For example I can get all data from 11ty global inside header/section.liquid file {{ collections.all[0].template.templateData.globalData | debug }}

But if use new tag {% render 'header/section' %} I got undefined <pre>undefined</pre>

I can get access to data only outside file section.liquid {% render 'header/section' for contact.buttons as item %}

liquid have section tag, but js version not. liquidjs have only render, include, layout tags. But include is Deprecated and working good. Render tag have problem.

shkarinn avatar Jan 21 '24 19:01 shkarinn

You have to set it to globals for access in render. That's intended and thus different from include. I guess maybe we shouldn't deprecate include as we don't have plans to support section.

harttle avatar Jan 23 '24 04:01 harttle

You have to set it to globals for access in render. That's intended and thus different from include. I guess maybe we shouldn't deprecate include as we don't have plans to support section.

I don't yet know how to set access to a global object for a single tag.... So far I have found the following solution. I will continue to use include for sections and ready blocks. And render for mixins (macros).

shkarinn avatar Jan 25 '24 12:01 shkarinn