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
    0

    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:

    ~/Views/Partials/Grid/Editors/Media.cshtml
    

    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 95 posts 242 karma points
    May 13, 2020 @ 00:09
    Liam Dilley
    0

    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
    0

    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 26 posts 181 karma points
    Jul 20, 2020 @ 10:28
    Sjoerd Stottelaar
    0

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

  • David Armitage 414 posts 1655 karma points
    Aug 04, 2020 @ 12:26
    David Armitage
    0

    Hi,

    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

    Regards

    David

  • 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.

Please Sign in or register to post replies