I have one rte filed with some value like data-custom = '{test}'.

I am using @Html.Sitecore().Field("LINK", Model.Item, new { @class = "testclass"}).

How to add value from rte filed and append to anchor tag?

  • If the data attribute name is always the same, you could use approach shown here stackoverflow.com/questions/36158550/…. Then move content of data-attribute to plain text field, add that to model and out put. Jun 30, 2023 at 7:10
  • no data attribute name is not always same.
    – kuldeep
    Jun 30, 2023 at 7:17
  • @kuldeep My suggestion is customization. You can achieve this by creating a custom HTML helper in your Sitecore solution. The custom HTML helper will extract the value from the RTE field, and then you can use it to construct the anchor tag. Jul 21, 2023 at 13:34


Your Answer

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

Browse other questions tagged or ask your own question.