In a template, how do I get what page I'm currently on? I'd rather not pass a variable like page
, especially when I know some request.xxx
can provide me with the information.
<li {% if page=="home" %}class="active"{% endif %}>
<a href="/">Home</a>
</li>
<li {% if page=="about" %}class="active"{% endif %}>
<a href="/about">About</a>
</li>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…