Compiler Error Message: CS1061:'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'Content' and no extension method 'Content' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)Source Error:Line 40: @if(post.Content.HasValue("featuredImage")){
No more error but still not seeing any images on the blog page... I didnt see a "featuredImage" I used a media picker for in the post content but I dont see a doc type -> generic property for featured image
Featured Image with Articulate Blog
Hi,
I have my blog set up to show on a blog page but I want to include a featured image/thumbnail on the list of blog posts This is my code now:
So Im hoping someone can tell me what to add into the img src field to pull a featured image out of the post.
Thanks a million! J
Hi Jeff,
Could you please try something like this, if you are using the media picker to pick the thumbnail image, from the media library.
Hope this helps,
/Dennis
Thanks for the help now I am getting this:
Change
post.Content
to simplypost
(i.e., remove the.Content
).No more error but still not seeing any images on the blog page... I didnt see a "featuredImage" I used a media picker for in the post content but I dont see a doc type -> generic property for featured image
Hi Jeff,
You need to add a property of the type media picker to the post document type so the user add a image from the media library.
The alias of the property should be featuredImage, then you should be able to use the code above.
Hope this helps,
/Dennis
Dennis,
Your a lifesaver thanks a ton!
Jeff
Also how do I add it into the post itself?
@Model.featuredImage doesnt seem to be working...
Hi Jeff,
Could you try this.
Hope this works for you.
/Dennis
It didnt break the site but it didnt add the image
Hi Jeff,
Okay and you are adding the image on the node in the that you viewing in the browser.
Model.Content refers to the current page that you are viewing. See this documentation https://our.umbraco.org/documentation/reference/templating/mvc/views
Hope this helps,
/Dennis
is working on a reply...