How do I pass data to the Eta View Layout?
Open
help wanted
- Dominant language
- No language data
- Stars
- 68
- Forks
- 8
- Avg merge
- 11h 2m
- Merged PRs (30d)
- 2
Description
Hello there,
I want to pass some data to the layout template but I have no idea how.
The "intuitive one" doesn't work.
I want to create a multi-language website and use a lang.json file to do it.
For now I'm trying to change the title of the layout but this doesn't work at all.
index.js
```js
app.register(require("@fastify/view"), {
engine: {
eta: require("eta")
},
root: path.join(__dirname, "views"),
layout: "layout.eta",
propertyName: "render"
})
```
layout.eta
```html
<% it.title %>
layout
<% it.body %>
```
home.eta
```html
home
```
I also tried `<% layout("views/layout.eta", {it}) %>`
Contributor guide
Assessment
This issue has not been assessed yet.