Support Jekyll-like includes: {% include {{ page.my_variable }} %}
See original GitHub issue{% include prefix/{{ page.my_variable }}/suffix %}
Just like it’s included in Jekyll: https://jekyllrb.com/docs/includes/#using-variables-names-for-the-include-file
It’s basically an improved and more flexible version of dynamic partials.
I tried working this limitation around in fs.readFile(path)
interface, but unfortunately, the spec is too limited. The only argument passed is prefix/{{ page.my_variable }}/suffix
. Liquid context is lost, so I cannot run this string through the Liquid engine again for processing to read the correct file.
If the spec of fs
is modified to fs.readFile(path, context)
or there’s this.liquidContext
, it would make my use case trivial to implement in fs
, unless you want to make Jekyll-like dynamic includes an official part of Liquidjs.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Includes | Jekyll • Simple, blog-aware, static sites
Includes. The include tag allows you to include the content from another file stored in the _includes folder: {% include footer.html %}.
Read more >Master file - serhii.net
Do I want to get a clear picture of all the various levels of escaping, including globs, backticks, backslashes etc. happening in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@harttle Implementation & docs are perfect, thank you! Thanks a lot! I’ll promptly update and remove our
readFile
hackery 😃In the meantime, my project - rendering Jekyll sites in Gatsby - is moving forward! We have almost everything implemented already… Very exciting.
I can try make this happen. If there’s no perf regression I think we can ship an updated include. Otherwise, extending include would be better compared to rendering templates in FS.