In my item I have a RichText field that I am returning the value via an api (API controller called from jQuery).

In the response, I am able to render the value.

But issue is that my RichText field value contains an item link like this: <a href="~/link.aspx?_id=67HTg5464321&amp;_z=z">here</a>

Do we have any option to render my RichText field using HTML.RAW in jQuery or any other option to do the same arrangement in controller before returning to jQuery response.

As I want my link item to converted before rendering to the friendly url (ex: https://domain/abc/dec).

  • What API are you using? To get the link returned correctly, you are going to need to run the field through the FieldRenderer pipeline.
    – Richard Seal
    Jan 3 at 19:34

1 Answer 1


If you get the value of a rich text field like


you will receive raw value of the field, including internally formatted links like <a href="~/link.aspx?_id=67HTg5464321&amp;_z=z">here</a>

You need to add the following code to render value of the field:

Sitecore.Data.Items.Item item;
string fieldName;

var fieldRenderer = new Sitecore.Web.UI.WebControls.FieldRenderer();
fieldRenderer.Item = item;
fieldRenderer.FieldName = fieldName;
fieldRenderer.DisableWebEditing = true;
RenderFieldResult renderFieldResult = fieldRenderer.RenderField();
string richTextFieldValue = renderFieldResult.ToString();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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