I'm trying to create a partial view macro that list all items (blog entries). I can read its name, but not the entry field like it's content:
@foreach (var page in CurrentPage.Children.Where("Visible").OrderBy("CreateDate desc"))
{
<div class="article">
<div class="articletitle">@page.Name</div>
<div class="articlepreview">
@Umbraco.Truncate(@page.Field("pageContent"),100)
<a href="@page.Url">Read More..</a>
</div>
</div>
<hr/>
}
All pages are defined as a ContentPage
(document type) where I've added Page Content (pageContent), type: Richtext editor
as a Tab: Content
element.
Do I need to cast the page or something to Contentpage
?
What Im trying to do Is to give a 100 char long preview of the content on my main page so the users can read a short excerpt before clicking on the item.