<conref>: How do you use the <conref> element to reuse content from one DITA topic within another topic, enabling modular content authoring?

The <conref> element in DITA XML is a powerful tool that enables modular content authoring by allowing you to reuse content from one DITA topic within another topic. This reuse mechanism simplifies content management, ensures consistency, and reduces redundancy.

Defining Content to Be Reused

To use the <conref> element, you first need to define the content you want to reuse in the source topic. Here’s an example of how you can define a reusable paragraph in a source topic:


<topic id="source_topic">
  <title>Source Topic</title>
  <body>
    <p id="reusable_paragraph">This is a reusable paragraph.</p>
  </body>

Reusing Content in Another Topic

Once you’ve defined the reusable content, you can reference it in another topic using the <conref> element. Here’s an example:


<topic id="target_topic">
  <title>Target Topic</title>
  <body>
    <conref href="source_topic.dita#reusable_paragraph"/>
  </body>

In this example, the <conref> element references the “reusable_paragraph” from the “source_topic.dita” topic. When you publish or generate output, the content from the source topic will be included in the target topic, allowing you to reuse content efficiently.