Dheeraj Palagiri
Dheeraj Palagiri

Reputation: 1879

RenderLink is hidden in experience editor mode

We are on sitecore 8.1 update 3 and Glass Mapper 4.2.1.188.

Render Link works on normal mode, but we look at same link in experience mode its hidden?

Razor Code:

<div class="c-home__cta">
    @RenderLink(x => x.CallToActionButton, new { @class = "c-btn c-btn--strong c-btn--large" }, isEditable: true)
</div>

Page source of experience editor mode:

<input id='fld_445CAE7C73764E3BBE7298BB2F1AC2F7_8381EE66B5A54D74B92C9171CD688959_en-GB_7_d1e84aa9693343f28b3b8ac3a0990b8d_35' class='scFieldValue' name='fld_445CAE7C73764E3BBE7298BB2F1AC2F7_8381EE66B5A54D74B92C9171CD688959_en-GB_7_d1e84aa9693343f28b3b8ac3a0990b8d_35' type='hidden' value="&lt;link linktype=&quot;internal&quot; text=&quot;Discover More&quot; querystring=&quot;&quot; target=&quot;&quot; id=&quot;{8CBC614A-F2B4-4842-81DA-BE4B57992547}&quot; /&gt;" /><span class="scChromeData">{"commands":[{"click":"chrome:field:editcontrol({command:\"webedit:editlink\"})","header":"Edit link","icon":"/temp/iconcache/networkv2/16x16/link_edit.png","disabledIcon":"/temp/link_edit_disabled16x16.png","isDivider":false,"tooltip":"Edits the link destination and appearance","type":""},{"click":"chrome:field:editcontrol({command:\"webedit:clearlink\"})","header":"Clear Link","icon":"/temp/iconcache/networkv2/16x16/link_delete.png","disabledIcon":"/temp/link_delete_disabled16x16.png","isDivider":false,"tooltip":"Clears The Link","type":""},{"click":"chrome:common:edititem({command:\"webedit:open\"})","header":"Edit the related item","icon":"/temp/iconcache/office/16x16/cubes.png","disabledIcon":"/temp/cubes_disabled16x16.png","isDivider":false,"tooltip":"Edit the related item in the Content Editor.","type":"common"},{"click":"chrome:rendering:personalize({command:\"webedit:personalize\"})","header":"Personalize","icon":"/temp/iconcache/office/16x16/users_family.png","disabledIcon":"/temp/users_family_disabled16x16.png","isDivider":false,"tooltip":"Create or edit personalization for this component.","type":"sticky"},{"click":"chrome:rendering:editvariations({command:\"webedit:editvariations\"})","header":"Edit variations","icon":"/temp/iconcache/office/16x16/windows.png","disabledIcon":"/temp/windows_disabled16x16.png","isDivider":false,"tooltip":"Edit the variations.","type":"sticky"}],"contextItemUri":"sitecore://master/{445CAE7C-7376-4E3B-BE72-98BB2F1AC2F7}?lang=en-GB&ver=7","custom":{},"displayName":"Call to action button","expandedDisplayName":null}</span><span scFieldType="upm general link" scDefaultText="[No text in field]" contenteditable="true" class="scWebEditInput" id="fld_445CAE7C73764E3BBE7298BB2F1AC2F7_8381EE66B5A54D74B92C9171CD688959_en-GB_7_d1e84aa9693343f28b3b8ac3a0990b8d_35_edit"><link linktype="internal" text="Discover More" querystring="" target="" id="{8CBC614A-F2B4-4842-81DA-BE4B57992547}" /></span>

Any suggestions will be appreciated.

Upvotes: 0

Views: 810

Answers (1)

Ayman Barhoum
Ayman Barhoum

Reputation: 1255

By default the text displayed to the user in the link is either the value from the Description field for external links or the name of the target Sitecore item, i think you have these values empty, you can override link text by contents parameter, so just add any text or blank space for contents if the page in edit mode :

@if (Sitecore.Context.PageMode.IsExperienceEditorEditing)
{
 RenderLink(x => x.CallToActionButton, new { @class = "c-btn c-btn--strong c-btn--large" }, isEditable: true,contents: "some text")
}
else
{
RenderLink(x => x.CallToActionButton, new { @class = "c-btn c-btn--strong c-btn--large" })
}

Upvotes: 2

Related Questions