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
Upgrading an old (pre-2.x) Eleventy site to v3, I ran into what seems to be a bug with the renderContent filter. The context is that the site uses front matter data for repeating content on pages, such as page sections. So you might have something like this:
---title: Homesections:
- title: About Uscontent: This is who we are.
- title: Our Workcontent: This is what we do.
- title: Contact Uscontent: This is how to reach us.---
In the template, had been using the following Nunjucks templates to render these sections (with a custom universal filter, markdown, that rendered Markdown to HTML using markdown-it:
However it doesn't appear to work— I now get a blank output for the entire include (no <section>, <h2> or rendered content). Nothing appears in the debug logs when running DEBUG=Eleventy* npx @11ty/eleventy that points me in the right direction to solve this either.
I tried another approach based on this article— using a macro— and that didn't work either.
Operating system
macOS Sequoia 15.3.1 (24D70)
Eleventy
3.0.0
Describe the bug
Upgrading an old (pre-2.x) Eleventy site to v3, I ran into what seems to be a bug with the renderContent filter. The context is that the site uses front matter data for repeating content on pages, such as page sections. So you might have something like this:
In the template, had been using the following Nunjucks templates to render these sections (with a custom universal filter,
markdown
, that rendered Markdown to HTML usingmarkdown-it
:_includes/layouts/home.njk
_includes/partials/components/section.njk
My hope was that with v3 I could drop the custom filter and use
renderContent('md')
like this:_includes/partials/components/section.njk
However it doesn't appear to work— I now get a blank output for the entire include (no
<section>
,<h2>
or rendered content). Nothing appears in the debug logs when runningDEBUG=Eleventy* npx @11ty/eleventy
that points me in the right direction to solve this either.I tried another approach based on this article— using a macro— and that didn't work either.
Reproduction steps
npm start
Expected behavior
The
renderContent
filter should work when used in Nunjucks included templates and macros.Reproduction URL
https://github.com/greatislander/11ty-rendercontent-test
Screenshots
N/A
The text was updated successfully, but these errors were encountered: