We're trying to implement Anchor Link on our existing Link Component by Enabling Anchor Feature in cd_link_conf.xml

This is our configuration looks like

<Publications OverrideDiscoveryService="true">
    <Publication Id="33">
        <Host Domain="mysite.test" Port="80" Path="" Protocol="https" />
        <Linking ComponentAnchors="true" AddComponentLinkInfo="true" />

Link schema enter image description here

and our link model class

@EqualsAndHashCode(callSuper = true)
public class Link extends AbstractEntityModel {

    private String linkTekst;

    // url property; neem externeLink als interneLink niet bestaat.
    private String url;

    private EntityModel embeddedLink;

    private String alternatieveTekst;
    private Tag linkStyle;

We came with 2 problems:

  • Anchor hash is not added in the url
  • url always use domain defined by cd_link_conf.xml. It's not dynamic following where the web application runs (e.g. on localhost, urls points to mysite.test domain instead of localhost)

Is there anything that I miss?


  • Java application uses dxa 2.0.3 framework.
  • Dxa Model service 2.2.2

1 Answer 1


In general, CD Linking generates absolute URLs if you define Publication mappings in cd_link_conf.xml.

If you prefer server-relative URLs (which is often the case), you should not define any Publication elements in cd_link_conf.xml (Maybe it also works if you do define Publication elements, but no Host elements; never tried that).

Regarding ComponentAnchors=true: I’m not sure if you can make that work with DXA (again, never tried that).

Note that link resolving is typically done in the DXA Model Service, so you will have to use the DXA Model Service’s cd_link_conf.xml.

  • The cd_link_conf.xml that I mentioned was indeed from DXA Model Service. I assume this would be officialy supported by the product?
    – Chris
    Commented Sep 3, 2020 at 8:05
  • Changing the cd_link_config.xml of the DXA Model Service, you mean? Yes, that is supported. But not all features of CD Linking have been tested icw DXA. Commented Sep 3, 2020 at 16:17

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.