更新时间:2022-04-22 23:06:19
您可以在 res.render中包含
数据,然后在模板中,例如: page_name:'about'
You could include a page_name: 'about'
in the res.render
data and then in the template something like:
<li <% if (page_name === 'about') { %>class="current" <% } %> ><a href="/about">About</a></li>
我没有测试语法,但这就是要点。
I didn't test the syntax, but that's the gist.