Express.js with layout
- Dominant language
- JavaScript
- Stars
- 22
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
When using nTPL in Express with layout:true, a template is supposedly forwarded as a 'body' local to the layout template -- this seems roughly another version of nTPL's own extends function.
The Express approach doesn't seem to work for me though, when i do this:
---
## test.nTPL
{%set name test %}
{%extends layout %}
{%block 'body' %}
hi there
{%/block%}
---
## layout.nTPL
{%set name test %}
{%block 'body' %}
how are you
{%/block%}
---
## run.js
res.render('test');
Then only 'how are you' is rendered. I have tried adding {%set args body %} but this doesn't seem to help.
Any ideas what i am doing wrong, or is this a shortcoming in the current Express implementation of nTPL?
Thanks,
-lite
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the behavior with test.nTPL, layout.nTPL, and run.js using Express's res.render('test') call. Read how the Express integration passes the body local and how nTPL's extends and block handling interact. Done means the documented layout:true flow renders the child template's “hi there” content inside the layout, or the limitation is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100