When you need to reuse a part of a DITA topic in different places (in the same topic or in
different topics) it is recommended to create a separate component and insert only a reference
to the new component in all places. Below are the steps for extracting a reusable component,
inserting a reference to the component and quickly editing the content inside the
component.
-
Select with the mouse the content that you want to reuse in the DITA file opened in
Author mode.
-
Start the action Create Reusable Component that is available on
the DITA menu, the Author framework actions toolbar and the contextual menu of the Author
editor.
-
In the combo box Reuse Content select the DITA element with the
content that you want to extract in a separate component. The combo box contains the
current DITA element where the cursor is located (for example a p element
- a paragraph - or a step or a taskbody or a
conbody etc.) and also all the ancestor elements of the current
element.
-
In the Description area enter a textual description for quick
identification by other users of the component.
-
If you want to replace the extracted content with a reference to the new component you
should leave the checkbox Replace selection with content reference
with the default value (selected).
-
Press the Save button which will open a file system dialog where
you have to select the folder and enter the name of the file that will store the reusable
component.
-
Press the Save button in the file system dialog to save the
reusable component in a file. If the checkbox was selected in the Create
Reusable Component dialog the conref attribute will be
added to the element that was extracted as a separate component. In Author mode the
content that is referenced by the conref attribute is displayed with grey
background and is read-only because it is stored in other file.
-
Optionally, to insert a reference to the same component in other location just place
the cursor at the insert location and run the action Insert Reusable
Component that is available on the DITA menu, the Author framework actions
toolbar and the contextual menu of the Author editor. Just select in the file system
dialog the file that stores the component and press the OK button.
The action will add a conref attribute to the DITA element at the insert
location. The referenced content will be displayed in Author mode with grey background to
indicate that it is not editable.
-
Optionally, to edit the content inside the component just click on the open icon
at the start of the grey background area which will
open the component in a separate editor.