kiss-ssg
Version:
Simple Static Website Generator
26 lines (22 loc) • 605 B
Markdown
## Controllers
The option mapper is really useful for mapping a slug from the model. This is great for dynamic slugs and a necessity when passing an array of models to the .pages() method to generate a series of pages.
```js
const Kiss = require('kiss-ssg')
const kiss = new Kiss({ test: '123' })
kiss
.page({
title: 'Page Title',
view: 'index.hbs',
})
.pages({
view: 'course.hbs',
model: 'https://{my-cool-api}/courses',
controller: ({ model }) => {
return {
slug: model.slug,
}
},
path: 'courses',
})
.generate()
```