I have a template with paramaters
@(title: Html, topbar: Html, nav: String = "")(content: Html)
I use the @title tag to set both a title for the page and a page header i.e.:
<div class="header">
<h1>@title</h1>
</div>
However, Some pages I dont want to put a header/title in so i leave them blank and tried:
@if(title != {}){
<div class="header">
<h1>@title</h1>
</div>
}
But this does not work.. How would I achieve this?
Thanks
You can pass null
value in the controller, in actions that shouldn't use the title
and then check if title != null
@if(title != null){
<div class="header">
<h1>@title</h1>
</div>
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With