I'm working with razor templates, I have two if
's inside a foreach
.
I've attached the simple code. But when I use Template Builder razor doesn't interpret the second if (it's like a text for Razor). If I add a @
before the if
, I get an error.
@foreach (var cp in ComponentPresentations) {
if (cp.Template.Title == "Identification") {
<title>@cp.Component.titlePage</title>
<head>
@* THE PROBLEM IS HERE *@
if (cp.Component.facebook.title != null) {
<meta property="og:title" content="@cp.Component.facebook.title" >
}
</head>
}
}
Someone can help me?