Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Render: renderFile & path #2101

Open
TigersWay opened this issue Nov 18, 2021 · 2 comments · May be fixed by #2451
Open

Plugin Render: renderFile & path #2101

TigersWay opened this issue Nov 18, 2021 · 2 comments · May be fixed by #2451

Comments

@TigersWay
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I do not like the fact that templates calling "micro-template(s)" have to be aware of the structure of the project. Right now they have to know where are, from the root of the project, theses rendered files.

Describe the solution you'd like
I would love to be able to pass the "root path" when initializing this plugin.
.eleventy.js

    eleventyConfig.addPlugin(EleventyRenderPlugin, {rootPath: "/site/_themes/grayTheme"})

any template

    {% renderFile "./_includes/blocks/blogpost.md" %}

blogpost.md is in /site/_themes/grayTheme/_includes/blocks

Describe alternatives you've considered
So far - I am a nunjucks only kinda guy - I can render file(s) from a pre-called nunjucks environment.

Additional context
As you can see in the example I gave before I often have the includes & layouts folders under some theme logic like: /site/_themes/grayTheme/_includes for example. I have that "logic" inside the config file of course, but don't want to carry it around in templates.

Thanks

@raffaelj raffaelj linked a pull request Jun 22, 2022 that will close this issue
@ivanminutillo
Copy link

it seems not possible to load external file with renderFile like :
{% renderFile "https://raw.githubusercontent.com/bonfire-networks/blog/master/code_of_conduct.md" %}
Any idea how to do it?

@zachleat
Copy link
Member

@ivanminutillo please file a separate issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants