The difference between keyrefs and conkeyrefs might be easier to see if we take a step back to before DITA used keys. Before there was key referencing, the equivalent elements for direct referencing were xref (cross-reference) and conref (content reference). If you wanted to create a link to direct your reader somewhere else, you used xref. If you wanted to reuse content from somewhere else and make it appear inline where you referenced it, you used conref.
While it’s true that xref can also take a piece of text from somewhere else and place it inline, the main differences between xref and conref are:
- xref is always rendered as a link
- xref needs the thing it’s linking to have a title element in order to insert that title text inline. Content from title is the only thing that xref can insert on its own (with the possible exception of additional locational information such as “…on page x” or “in chapter y”).
All of this also applies if you’re using keyref instead of xref, and conkeyref instead of conref. By using “insert link here” features – xref and keyref – you get “insert link here” behavior from DITA-aware systems. By using the “insert content here” features – conref and conkeyref – you get “insert content here” behavior, which is the better solution when your goal is to insert content.
Latest posts by Mike Rice (see all)
- How to Build a Winning Documentation Publishing Pipeline for Intelligent Content: Webinar – November 14th - November 8, 2019
- How to Reuse Localized DITA Content - September 13, 2018
- The Difference Between Keyrefs and Conkeyrefs - May 25, 2018