I have a field CoverImage
in my BlogPost
content definition, which I defined within the Content Definition menu in the admin control panel. I assume that whenever a BlogPost
is rendered I can access it somewhere within Model
from the associated alternate, e.g. via Model.ContentItem.BlogPostPart.Field["CoverImage"]
, or something similar.
But in reality, I can't find any field within the Model
that refers to custom fields at all whereas other fields such as Model.ContentItem.BlogPostPart.Title
or Model.ContentItem.BlogPostParts.Text
are available just fine. Can anyone explain?
[UPDATE]
Accesing @Model.ContentItem.BlogPostPart.CoverImage.Value
gave an error: 'Orchard.Blogs.Models.BlogPostPart' does not contain a definition for 'CoverImage'
.
I can't find CoverImage
in shape tracing:
Here's how I defined the CoverImage
field within Blog Post
content definition:
jmgomez is right...as he says it will be:
As a little explanation for anyone interested... A default part is attached to a content item, where fields are attached to. It shows up as ContentPart but it is actually accessed using the name of your content type, so in this case BlogPost is the Content Type and CoverImage is the name of the field.