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
Tried to use templateContent too early on ./src/blog/post1.md
Further information
This happens only with WebC. If I do the same on a njk page it works fine.
The repro project cannot be started at all, it always fails.
My actual project often starts properly (locally, but not on Netlify), the error just occurs every few times.
The text was updated successfully, but these errors were encountered:
rothsandro
changed the title
Content not accessible in webc file (Error: "Tried to use templateContent too")
Content not accessible in webc file (Error: "Tried to use templateContent too early")
Dec 4, 2023
Having the same issue, although I can't get my build to start at all. Paging through some of the other issues in 11ty/eleventy it appears that there's some sort of dependency-race-condition occuring where the templates content hasn't been built yet but the call to .content/.templateContent runs before Eleventy can transform the content of the template in question.
It looks like eleventyImport.collections (related GH issue) exists to mitigate template render order issues but I haven't figured out how to get to apply to WebC yet. Hopefully either a fix or workaround will come soon!
I recently hit the same issue and was putting together a minimum repro when I found this.
I have the same inconsistency where the minimum repro won't start at all. My other project will start fine but breaks the moment I edit anything triggering the reload.
The content of other pages is not accessible inside webc pages.
Repro
.webc
page that renders a list of posts with the contentRepro: https://github.com/rothsandro/repro.eleventy-webc-content
Expected
The posts with their content should be rendered.
Actual
An error is thrown
Further information
This happens only with WebC. If I do the same on a njk page it works fine.
The repro project cannot be started at all, it always fails.
My actual project often starts properly (locally, but not on Netlify), the error just occurs every few times.
Versions
The text was updated successfully, but these errors were encountered: