Images and keywords: When is keyref a better option than conkeyref? #conref #keys

Jonathan Hanna

Hi all,

I'm starting to explore the use of keys in my content, specifically for images and keywords. I see advantages for using conkeyref instead of keyref such as:
  • the attributes of the element (e.g. @outputclass or @props) being passed along with the content
  • the ability to use elements within the resued content (e.g. <sub> or<sup>)
Are there any scenarios where keyref would be more appropriate than conkeyref for images and keywords?



Good morning Jonathan,

it seems to me that having reusable images in a dedicated warehouse-topic is easier to manage than keydefs in a map: create a table with two columns where the left column holds your images and the right column displays the assigned image-ID and holds additional comments for context, if needed. Reference with conkeyref.
Keyrefs, on the other hand, seem to be well suited for what I like to call "content swapping": multiple keyscopes contain the same key with different hrefs, content is "swapped" depending on the keyscope. This is useful for cases where entire topics or parts of a topic are reused but the image needs to be different in each instance (this method, of course, is not restricted to images). Beware though: if you decide to use keyscopes, you’ll not be able to properly use reltables alongside with the current DITA-OT (3.5.2).