I would like to compare a variable with a string in my leaf template.
I get the variable through the controller in my template:
<!-- NAVBAR -->
<!-- #(path) = /database -->
<nav class="navbar navbar-default">
<div class="container-fluid">
<ul class="nav navbar-nav">
#if(path == "/database") {
<h1>Hello, there!</h1>
}
<li><a href="#">Filldatabase</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Contact</a></li>
</ul>
</div>
</nav>
<!-- END NAVBAR -->
I want it so that when I am on the /database
page, I get an h1 that says "Hello, there!". How can I do it? I think I need to use #if()
, but I can't find the proper syntax.
What you are looking for is the
#equal()
tag. You pass in two parameters, and if they are the same, if includes the HTML in the braces:So what you wan to use is this: