Content dependent markup in Umbraco using Razor
With Razor being so easy to use in Umbraco now, I thought I might try out a simple if statement to hide markup that wraps around non mandatory content.
Took a couple of attempts but it was fairly easy to do and works well.
<umbraco:Macro runat=”server” language=”cshtml”>
@if (@Model.aboutMeImage.ToString() != string.Empty)
{
<h6>About Me</h6>
<img src=”@Model.aboutMeImage” />
}
</umbraco:Macro>
-
alanfeekery posted this
