I have a news document type with an image field & text field for alternative text. Both render as expected from a template using the following <img src="@Umbraco.TypedMedia(node.GetPropertyValue("newsImage")).Url" alt="@Umbraco.Field("newsImageAlternativeText")"/>
I have created a partial view to return a list to include only news document types. This partial view is used on my home page template to render the news items including the image and alternative text field using the same code <img src="@Umbraco.TypedMedia(node.GetPropertyValue("newsImage")).Url" alt="@Umbraco.Field("newsImageAlternativeText")"/>
Image render as expected but alt tag is empty, <img src="/media/1014/newsimage.jpg" alt="">
Img tag alt property empty
Dear Umbraco team
I have a news document type with an image field & text field for alternative text. Both render as expected from a template using the following
<img src="@Umbraco.TypedMedia(node.GetPropertyValue("newsImage")).Url" alt="@Umbraco.Field("newsImageAlternativeText")"/>
I have created a partial view to return a list to include only news document types. This partial view is used on my home page template to render the news items including the image and alternative text field using the same code
<img src="@Umbraco.TypedMedia(node.GetPropertyValue("newsImage")).Url" alt="@Umbraco.Field("newsImageAlternativeText")"/>
Image render as expected but alt tag is empty,
<img src="/media/1014/newsimage.jpg" alt="">
Am i missing something or doing something wrong?
Thanks Dibs
Hi Dibs,
Umbraco.Field - returns value from current page.
You have to get alternative text from child node like:
Thanks
Cheers Alex
works a treat, thanks for explaining : )
Dibs
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.