eleventy
eleventy copied to clipboard
Warn users if they use {% include %} in Liquid templates (or update docs to deprecate {% include %})
Is your feature request related to a problem? Please describe.
I recently ran into the issue I filed here a while back: https://github.com/11ty/eleventy/issues/2000.
At first I thought maybe Liquidjs had regressed, but then I saw my comment at the end noting that this was only fixed for the {% render %} tag, not for {% include %} (which is now deprecated). See comment here: https://github.com/harttle/liquidjs/issues/404#issuecomment-955660149
include and layout are legacy tags which does not provide Context separation. In both Shopify/Liquid and LiquidJS, {% assgin %} in {%include%} files assigns to its parent template, thus will not hide include arguments. So it's by design and that's why {%include%} tag is deprecated.
Describe the solution you'd like
If a user's template language is set to Liquid and they use {% include %}, it would be nice if we could log a warning in the server console noting that this tag is deprecated and may not behave as expected. Otherwise, a user's template may fail silently.
I'm not sure if this is actually possible, though, because 11ty doesn't know when you use a particular tag, right? That's just the template language's job.
Describe alternatives you've considered
- Documentation updates to prominently deprecate
{% include %}: https://www.11ty.dev/docs/languages/liquid/#supported-features - Add a new config option in liquidjs that allows you to alias
{% include %}to{% render %}under the hood. And then 11ty could set this totrueby default.
Additional context
Would be happy to work on this if you think it's a worthwhile enhancement.