1.0.1 • Published 4 years ago

strapi-hook-handlebars v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

strapi-hook-handlebars

npm version npm downloads

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.

Resources