Created
October 1, 2013 09:48
-
-
Save DominicCronin/6776134 to your computer and use it in GitHub Desktop.
Example of Tridion Razor templating
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class=”@Component.Fields.NewsStyle”> | |
<img src=”@Fields.HeaderImage.ID” alt=”@Fields.HeaderImage.AltText” /> | |
@* Note that Fields is just a shortcut to Component.Fields *@ | |
<h2>@Fields.Header</h2> | |
<h5>@Fields.NewsDate.ToString(“dd/MM/yy hh:mm”)</h5> | |
<div class=”body-text”> | |
@Fields.BodyText | |
</div> | |
<ul> | |
@* Now we'll loop over a ComponentLink field and grab the component title and a field *@ | |
@foreach (dynamic linkItem in Fields.RelatedItems) { | |
<li>@linkItem.Title - @linkItem.Fields.Summary</li> | |
} | |
</ul> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment