4

I tried to Add Anchor Tag with Internal Link in the RTE field using HyperLink Manager in the RTE? But it allows to add either anchor or Internal Link in the RTE field.

I want to add both together like : http://localtest/en#Test using Internal Link

enter image description here

The only option that worked for me to manually edit the link in the the HTML tab of the RTE and append the anchor tag at the last as below:

enter image description here

Is there Any other solution or other way to achieve this functionality?

  • Why not just append the #test anchor part to the Url field in the hyperlink properties? – Richard Seal Sep 25 '17 at 16:25
  • Hi Richard, Actually i want to add the internal link with anchor together in the RTE field – Ashish Bansal Sep 26 '17 at 2:15
4

I just attempted this in Sitecore 8.2 Update 5 with no issues. Here are the steps.

Step 1 Open an Item with a Rich Text field and enter some text. Rich Text Editor open with greek provided for the example.

Step 2 Select the text you want to use for your anchor tag and then click the Hyperlink Manager button. You should be presented with the pictured dialog. Note that to set an anchor, you need to switch to the Anchor tab in the dialog. Hyperlink Manager open for creating an Anchor tag

Step 3 Select the text you want to use to link to your anchor tag and click the Hyperlink Manager button. You should be presented with the pictured dialog. Note that the Anchor field will allow you to pick from anchors that are already inserted into this particular Rich Text field. Upon selecting the anchor, the URL field should automatically update to the identifier for the selected anchor, with no protocol, hostname, or path, as expected. Hyperlink Manager open providing a list of preexisting anchors to choose from.

At this point if you accept out of the Rich Text Editor and save your content, your anchor and link should be all wired up. Here is the HTML from my example to show what markup is produced in the background: Rich Text editor open in HTML mode to display the HTML resulting from the operations described here.

  • Hi @Sergeant, the above solution is fine to add the Anchor Link only in the RTE field, I want to append the anchor# tag at the last of the link as below: localtest/en#Test – Ashish Bansal Sep 26 '17 at 2:17
1

You can still do it with the RTE Hyperlink manager to another item in the site.

  1. Select the text you want to create as the Hyperlink and click Insert Sitecore Link:

Select link text

  1. Now pick the Sitecore item you want to link too and click Insert:

Select the item

  1. Now right click the hyperlink text and chose Properties:

Link Properties

  1. In the Url field, go to the end of the text box and add your anchor tag here:

Add anchor to url

Its not the prettiest solution, but is a little easier for content editors if they don't feel comfortable adding the anchor to the markup. Ideally, the anchor field would be changeable to a textbox if you wanted to link to another page, rather than forcing you to only be able to link to local anchors - but this is a usable work around.

  • Hi @Richard-Seal, I My Case URL field is not populating with complete URL, its rendered as "http://" , I am using Sitecore 8.2 update 3, That's why I Need to update the anchor though Html code.. – Ashish Bansal Sep 26 '17 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.