Generating multiple pages / is it possible?
mpodciwinski opened this issue · comments
Hello,
I wonder if it is possible to generate multiple subpages from one .json file.
example .json file
[
{
"title": "A",
"website": "website-a.com"
},
{
"title": "B",
"website": "website-b.com"
}
]
using .hbs template:
<!DOCTYPE html>
<body>
<h1>{{title}}</h1>
<span>{{website}}</span>
</body>
</html>
and render to separate .html files with custom names from data.json (for example {{title}}
)
├── dist
│ ├── a.html
│ ├── b.html
├── data
│ ├── data.json
├── template
│ ├── template.hbs
it is possible?
This is possible, yes. The patterns have been documented in past issues. Please have a look at those and let me know if you’re still having trouble making it work!
this is very close #46 (comment), but i need render file from .hbs templates. How to do that?
Any ideas?
Unfortunately I don't have time to create the example code for you, but what you're trying to do is absolutely possible. You should be able to start with the code in #46 and also use lines 14-23 here:
https://github.com/shannonmoeller/tmp/blob/master/gulpfile.js