You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, there is no way to pass along 11ty global data and the page variable because these are not accessible from the .eleventy.js config as far as I can tell. How do I proceed?
Expected behavior
It should be possible to access 11ty data and page data from within a rendered partial since render is the recommended tag for rendering partials in Liquid.
Observed behavior page is undefined inside a rendered partial.
Environment:
OS and Version: N/A
Eleventy Version: 1.0.1 (also observed on 2.0.0-canary-11)
NOTE: It is possible to work around this issue by passing in the necessary information as arguments. But I'm wondering if there's a way to avoid having to do that.
The text was updated successfully, but these errors were encountered:
Describe the bug
Per the Liquidjs docs, the {% include %} tag is deprecated and it's recommended that we use the {% render %} tag instead. See also: #2411. Unfortunately, while it's currently possible to use the
{% render %}
tag in 11ty, it's not possible to access globals or global data from within the rendered template. Per the Liquid docs on render:However, the section on passing in arguments to the rendered template clarifies that globals should be accessible:
The
LiquidOptions
interface does have aglobals
config here: https://github.com/harttle/liquidjs/blob/01029aba87e9a40ce104cdd9b8228170f345792c/src/liquid-options.ts#L65-L66. And 11ty supports configuring Liquid options viaeleventyConfig.setLiquidOptions
.Unfortunately, there is no way to pass along 11ty global data and the page variable because these are not accessible from the
.eleventy.js
config as far as I can tell. How do I proceed?To Reproduce
Steps to reproduce the behavior:
yarn
to install 11ty, the only dependency.yarn serve
to start the server.render
ed partial is accessible within the partial, as expected.page
variable is not accessible within the partial (unexpected)..eleventy.js
src/_includes/partial.html
src/index.html
Expected behavior
It should be possible to access 11ty data and page data from within a
render
ed partial sincerender
is the recommended tag for rendering partials in Liquid.Observed behavior
page
is undefined inside arender
ed partial.Environment:
Additional context
#2411
NOTE: It is possible to work around this issue by passing in the necessary information as arguments. But I'm wondering if there's a way to avoid having to do that.
The text was updated successfully, but these errors were encountered: