Glass Mapper RenderLink link description - default text if empty
问题 <li>@if (string.IsNullOrWhiteSpace(topLinks.Target.Text)) { topLinks.Target.Text = "EMPTY DESCRIPTION"; } @(RenderLink(topLinks, x => x.Target, isEditable: true)) </li> I need a way to catch it when a Content Editor has set up a link, but not actually put a Link Description in. At the moment it just renders spaces. The above works, but it's clunky and I need to put it everywhere I use a RenderLink . How do I default the text if it's empty? 回答1: I've created an extension method to work around