I have added a Textbox field named excerpt
to the default Blog Post document type in Umbraco 7. Umbraco reports a compilation error when it tries to access the data in that excerpt field.
In my template:
@{
var recentblogpost = Model.Content.Site().FirstChild("BlogPostRepository").Children("BlogPost").Last();
}
@recentblogpost.Name, @recentblogpost.excerpt
Getting @recentblogpost.Name
or @recentblogpost.Url
succeeds. Only the custom fields I add such as @recentblogpost.excerpt
don't succeed. I have tried switching the capitalization case to @recentblogpost.Excerpt
.
The error which is reported:
Compiler Error Message: CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'excerpt' and no extension method 'excerpt' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
This snippet worked. @recentblogpost["excerpt"]