foundation / foundation/panini
Generate pages on the fly from data
- Dominant language
- JavaScript
- Stars
- 593
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
**Current State**
Put HTML and markdown into .html files stored in /pages and you get a url per page:
```
/pages
..../home.html
..../contactus.html
..../info1.html
/layouts
..../default.html
/data
....
$ foundation build
// resulting URLs
http://example.com/home.html
http://example.com/contactus.html
http://example.com/info1.html
```
**Requested Capability**
Put HTML and markdown into a hierarchical JSON doc get a url per page:
```
/pages
..../empty
/layouts
..../default.html
/data
....pages.json (this is a 10MB JSON file with a record per page)
$ foundation build
// resulting URLs
http://example.com/home.html
http://example.com/contactus.html
http://example.com/info1.html
```
I have a use-case for this. My project has a SQL database and we'd like to create a static, read-only site where there is 1 page per record. I can write a program to create the json file from the database and I can also generate a whole bunch of /pages/*.html files from the database. In current state, I will have to generate a whole bunch of /pages/*.html files.
**Potential API:**
The root parameter can take a directory for physical .html files and/or a hierarchical JSON doc.
```
var jsonDocOfPagesData =
/// ...
.pipe(panini({
root: ['src/pages/', jsonDocOfPagesData],
layouts: 'src/layouts/',
partials: 'src/partials/',
data: 'src/data/',
helpers: 'src/helpers/'
}))
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.