Skip to content

Commit

Permalink
Set image alt attribute to empty string if media text is null or empty
Browse files Browse the repository at this point in the history
  • Loading branch information
DrewBrasher committed Oct 9, 2024
1 parent 28de8c7 commit 18a7f7a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
var path = paths[i];
var url = Orchard.AssetUrl(path);
var text = !string.IsNullOrEmpty(mediaTexts.ElementAtOrDefault(i)) ? mediaTexts[i] : path;
var alt = !string.IsNullOrEmpty(mediaTexts.ElementAtOrDefault(i)) ? mediaTexts[i] : string.Empty;

if (Orchard.IsImageFile(path))
{
<img src="@url" alt="@text">
<img src="@url" alt="@alt">
}
else
{
Expand Down

0 comments on commit 18a7f7a

Please sign in to comment.