eleventy: renderTemplate fails with simple example (global versus local install)
Describe the bug I’m trying this simple example of the renderTemplate feature (using beta8):
{% assign name = "Ray" %}
Hello World, and {{ name }}
<p>
{% renderTemplate "md" %}
# I am a title
* I am a list
* I am a list
{% endrenderTemplate %}
And when I run eleventy, I get:
ray@Hoth:~/projects/testingzone/eleventybeta$ eleventy
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] > Having trouble rendering liquid template ./index.liquid
`TemplateContentRenderError` was thrown
[11ty] > Cannot read property 'includes' of undefined, file:./index.liquid, line:8, col:1
`RenderError` was thrown
[11ty] > Cannot read property 'includes' of undefined
`TypeError` was thrown:
[11ty] TypeError: Cannot read property 'includes' of undefined
at new TemplateRender (/home/ray/projects/testingzone/eleventybeta/node_modules/@11ty/eleventy/src/TemplateRender.js:31:23)
at Object.render (/home/ray/projects/testingzone/eleventybeta/node_modules/@11ty/eleventy/src/Plugins/RenderPlugin.js:31:12)
at Object.renderStringShortcodeFn (/home/ray/projects/testingzone/eleventybeta/node_modules/@11ty/eleventy/src/Plugins/RenderPlugin.js:224:27)
at Object.render (/home/ray/projects/testingzone/eleventybeta/node_modules/@11ty/eleventy/src/Plugins/RenderPlugin.js:116:40)
at async Template._render (/home/ray/.nvm/versions/node/v14.18.0/lib/node_modules/@11ty/eleventy/src/TemplateContent.js:315:22)
at async Template.getTemplateMapContent (/home/ray/.nvm/versions/node/v14.18.0/lib/node_modules/@11ty/eleventy/src/Template.js:1003:19)
at async TemplateMap.populateContentDataInMap (/home/ray/.nvm/versions/node/v14.18.0/lib/node_modules/@11ty/eleventy/src/TemplateMap.js:459:39)
at async TemplateMap.cache (/home/ray/.nvm/versions/node/v14.18.0/lib/node_modules/@11ty/eleventy/src/TemplateMap.js:360:5)
at async TemplateWriter._createTemplateMap (/home/ray/.nvm/versions/node/v14.18.0/lib/node_modules/@11ty/eleventy/src/TemplateWriter.js:242:5)
at async TemplateWriter.generateTemplates (/home/ray/.nvm/versions/node/v14.18.0/lib/node_modules/@11ty/eleventy/src/TemplateWriter.js:275:5)
[11ty] Wrote 0 files in 0.03 seconds (v1.0.0-beta.8)
To Reproduce See above. 😃
Expected behavior I’d expect the block to render from Markdown.
Environment:
- OS and Version: [e.g. Windows/Mac/Linux] Windows/WSL
- Eleventy Version [via
eleventy --version
ornpx @11ty/eleventy --version
] v1.0.0-beta.8
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 18 (8 by maintainers)
For the record @peerreynders I believe your issue is separate @cfjedimaster’s original issue. I filed yours at #2108. Specifically note this comment: https://github.com/11ty/eleventy/issues/2108#issuecomment-974714754
Reduced test case repo
Here there are no errors - instead the template render simply stops.
Upon
npm run build
the templatesrc/index.njk
results in the following markup
dist/index.html
:i.e the template fails to render past the point of the
renderTemplate "md"
.Platform:
FYI: https://github.com/11ty/eleventy/blob/master/src/TemplateRender.js#L29
results in
So that second
TemplateRender
instance is provided with the includes path as the input path.