razor - GlassMapper Render Link add Target for external Links -
we on sitecore 8.1 glassmapper 4.4.1.188.
we rendering image in anchor below:
using (beginrenderlink(item, x => x.carousellink, iseditable: true)) { @renderimage(item, x => x.carouselimage, iseditable: true) }
all works well.
how can force renderlink insert html target attribute based on sitecore input general link?
so, if content editor picks "external link" need link generated target="_blank"
when select external link, use new browser
option:
this cshtml code:
@using (html.glass().beginrenderlink(model, x => x.link)) { <span>aaa</span> }
and html output:
<a href="http://google.com" target="_blank"><span>aaa</span></a>
Comments
Post a Comment