How to show an image from blog post in list view on blog page?
Hi guys,
I am new to Umbraco so please excuse if this might be a bit of a silly question.
I built a website containing a blog page using the Umbraco Starter Kit.
I have some blog posts added which contain an image that I would like to be displayed on the blog page's list view and on the home page in the recent blog posts area.
Now I am struggling to achieve this and could not find any article or thread that might guide the way.
Could somebody assist me to achieve what I am looking for?
I think if you look at the Person Document Type in the sample site, you'll see that it uses a mediapicker. If you look at the template for people, that will give you the code block to display the photo:
@person.Photo.Url
If you instead use an tag in the template that you make(or adjust the Blog template), does that get you close to what you are looking for?
Struggling to work out where and how to place the code, and even what the code would need to look like as I am not a developer but a newbie to Umbraco and coding.
How to show an image from blog post in list view on blog page?
Hi guys,
I am new to Umbraco so please excuse if this might be a bit of a silly question.
I built a website containing a blog page using the Umbraco Starter Kit.
I have some blog posts added which contain an image that I would like to be displayed on the blog page's list view and on the home page in the recent blog posts area.
Now I am struggling to achieve this and could not find any article or thread that might guide the way.
Could somebody assist me to achieve what I am looking for?
Best regards
Robert
I think if you look at the Person Document Type in the sample site, you'll see that it uses a mediapicker. If you look at the template for people, that will give you the code block to display the photo:
If you instead use an tag in the template that you make(or adjust the Blog template), does that get you close to what you are looking for?
Hi Bryna,
Thanks a lot for the answer though.
Struggling to work out where and how to place the code, and even what the code would need to look like as I am not a developer but a newbie to Umbraco and coding.
Okay, so I found a way to achieve this now by simply add the following code to the LatestBlogposts.cshtml under Partial View Macro Files:
@if(post.FeaturedImage != null){
Hi Rob,
Struggling with this now myself, did you add a media picker to the blogpost doc type called 'FeaturedImage' and you're just referencing it with
@post.FeaturedImage.Url
Is there any steps I'm missing here?
Hi Alex,
Actually I am now using this piece of code on a partial view macro
That works perfectly for me
Thanks Rob!, Will have a play with it - couldn't get it working last night
is working on a reply...