How is content marked for reuse within a DITA topic?

In DITA, content is marked for reuse through the application of special attributes and elements. These markers indicate that specific portions of content are intended to be reused in multiple contexts or documents.

The most common markers include the keyref attribute, the conref attribute, and the key element.

Keyref Attribute:

The primary method for marking content for reuse is by using the keyref attribute. This attribute is applied to elements within a DITA topic to identify them as reusable content. The keyref attribute links to a key definition in a map or a key space, which specifies where the content should be reused.


        <keydef keys="warningNote" href="reuse.dita"/>
    

In a DITA topic, the keyref attribute is used to reference this key definition.


        <note keyref="warningNote">
          <title>Caution</title>
          <p>Do not proceed without proper authorization.</p>
        </note>
    

In this example, the <note> element is marked for reuse with the keyref attribute, which points to the warningNote key definition.

Conref Attribute:

Another method for marking content for reuse is through the conref attribute. The conref attribute allows referencing and reusing content from other DITA topics or files. It provides a way to include entire topics, sections, or elements within the current topic.


        <section conref="otherTopic.dita"/>
    

Or only specific elements can be reused.


        <p conref="glossary.dita#term-definition"/>
    

In both cases, the conref attribute points to the content to reuse.

Key Element:

The <keydef> element is used to define keys and their corresponding locations for content reuse. A key definition specifies which content is reusable and where it should be reused.


        <keydef keys="myKey" href="my-reusable-content.dita"/>
    

In this key definition, the myKey is defined to reuse content from the my-reusable-content.dita file.

Content marked for reuse using these methods can be inserted into different DITA topics, maps, or documents, allowing for efficient content sharing and maintenance.