How to Use Multiple Layout in Handlebars and Express

Assalamualaikum wr wb

Hello in this tutorial i will share how to use multiple layout in hbs (handlebars), before it im sorry if my english is bad.

In my project, i use express generator to fast generate my project. express generator use hbs module to generate template engine.

if you dont use express generator you can install with npm install hbs.

Oke to the point, if you will use multiple layout you must add {layout: 'yourlayout.hbs'} in your router.

This is the example :

router.get('/', function(req, res) {
    res.render('index', {layout: 'yourlayout.hbs'});
});

Ok thanks for visiting my blog, i get this tutorial from stackoverflow in this thread https://stackoverflow.com/questions/30467456/multiple-layouts-with-handlebars-and-expressjsa

Subscribe to receive free email updates:

0 Response to "How to Use Multiple Layout in Handlebars and Express"

Post a Comment

1. Berikan Komentar yang Relevan
2. Tidak Mengandung SARA
3. Berkomentar yang Sopan

Konsultasi Aplikasi