I want to append the component URI as an # anchor to the resolved link URL for component links in Rich Text fields. According to the DXA 2.0 Docs, you can get the Model Service to leave the component URI in de xlink:href attribute when resolving the Rich Text field by setting a configuration setting in dxa.properties:


I have set this property, and restarted the Model Service, but I still don't see the xlink:href in the JSON returned by the Model Service. Am I missing something?

If I can get this to work, then I can add some logic in my ViewModel to postprocess the links and move the component uri from the xlink:href to the href as an # anchor.


1 Answer 1


After digging around in the code and looking at the published JSON, I have come to the conclusion that the example in the documentation is misleading.

In the published JSON, DXA 2.0 does not represent links in RTF fields in the format documented (with an xlink:href) but rather with a normal href attribute (not xlink). As such, regardless of whether you set this property in the Model Service or not, you will not get an xlink:href attribute in the output, unless you have customized the publishing process to add one, or you have published using another format (for example DD4T)

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.