layouts in expressjs

前端 未结 1 1016
盖世英雄少女心
盖世英雄少女心 2021-02-08 04:49

I want to use 2 layouts for main page and admin page
What should i configure my code to do that?
here is my current code configure

app.configure(fu         


        
1条回答
  •  [愿得一人]
    2021-02-08 05:22

    I usually set layout to false globally, so I know exactly what layout I use where (so no default layout):

    app.set('view options', { layout: false });
    

    Then in my routes I can set a layout per route like so:

    res.render('my_page', { layout: 'my_layout' });
    

    Read more about Express layouts and templates engines

    0 讨论(0)
提交回复
热议问题