Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Nicolas Erlijman 14 posts 103 karma points
    May 06, 2020 @ 23:08
    Nicolas Erlijman

    umbraco 8 - Add alt or title property to existing image content in grid editor

    I want to add new properties to the existing image render of the content grid editor that is located in:


    As listed in the current code, it renders an image with this lines:

    var altText = Model.value.altText ?? Model.value.caption ?? string.Empty;
    <img src="@url" alt="@altText">

    Where it takes the values for @altText?

    I have added a property to the media datatype "altText" but is always null.

    Where this altText comes from?

  • Liam Dilley 147 posts 373 karma points
    May 13, 2020 @ 00:09
    Liam Dilley

    The alt text is the image caption which you can find in the bottom of the grid. It is an issue/ oversight in my eyes. The image caption is good for that sort of thing but it should be two options. 1. Image caption 2. Image alt text

  • Nicolas Erlijman 14 posts 103 karma points
    May 13, 2020 @ 01:58
    Nicolas Erlijman

    However, in the code for rendering media, there is an OR for altText and caption. And in the editor you can only type one. Where the other value come from ? Very confusing....

  • Sjoerd Stottelaar 31 posts 189 karma points
    Jul 20, 2020 @ 10:28
    Sjoerd Stottelaar

    Have you found a solution to fix this? I'm running into the same issues.

  • David Armitage 503 posts 2071 karma points
    Aug 04, 2020 @ 12:26
    David Armitage


    If it was me I would probably recommend adding a custom property to the Image media type.

    That way you can then go into the media section and set the alt tag there. This would mean that whereever you use that image it will always have to same alt tag. Regardless of if you used it in a Grid Editor / Rich Text Editor.

    enter image description here



  • Angel 49 posts 105 karma points
    Sep 26, 2023 @ 17:01

    Hi David,

    If we add another (mandatory) property to Image, say called AltText, how does output of the content of the Rich Text Editor know to inject the value from that field into the alt property when it renders the image? Do we have to do something special to make that connection?

Please Sign in or register to post replies

Write your reply to: