Vapor Swift - Compare two strings

Viewed 215

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.

1 Answers
Related