We are on sitecore 8.1 GlassMapper 4.4.1.188.
We are rendering an image in an anchor like below:
using (BeginRenderLink(item, x => x.CarouselLink, isEditable: true))
{
@RenderImage(item, x => x.CarouselImage, isEditable: true)
}
All works well.
How can we force Renderlink to insert Html Target attribute based on sitecore input from General Link?
So, if content editor picks "External link" we need link to be generated with target="_blank"
When you select external link, use New browser
option:
This is cshtml code:
@using (Html.Glass().BeginRenderLink(Model, x => x.Link))
{
<span>aaa</span>
}
and this is html output:
<a href="http://google.com" target="_blank"><span>aaa</span></a>