strapi-hook-handlebars
v1.0.1
Published
Handlebars hook for the Strapi framework
Downloads
7
Readme
strapi-hook-handlebars
This built-in hook allows you to use the Handlebars template engine with custom options.
Configuration
To configure your hook with custom options, you need to edit your ./config/hook.json
file in your Strapi app.
{
...
"handlebars": {
"enabled": true
}
}
More information in the Koa handlebars module https://github.com/newoceaninfosys/koa-hbs#options
Usage
Insert code in your controller to render a view.
module.exports = {
home: async ctx => {
return await ctx.render('home', {
title: 'My app title',
});
},
};
This will render the views/home.hbs
file and you will have access to <%= title %>
data in your hbs file.