Adding Labels to Topics in the WebHelp Responsive Output
13 Dec 2021
Read time: 3 minute(s)
DITA topics can contain
<keyword>
elements that are usually placed
in a <prolog>
element, but they can also be used inside the topic
body contents.
<topic id="topicID">
<title>DITA 1.3 Features</title>
<prolog>
<metadata>
<keywords>
<keyword>DITA 1.3</keyword>
</keywords>
</metadata>
</prolog>...
The Oxygen WebHelp Responsive output uses these keywords
as a way of giving more priority to certain sequences of words when searching for
content. By default, keywords do not appear in the published output.This article is an attempt to add a new concept of a label:
- A label is a keyword element with
a special
@outputclass="label"
attribute. The label is always visible in the published output. It can be placed either in a prolog section or anywhere inside the topic where a keyword is allowed. - When a label is selected, the WebHelp output displays all other topics that have the same label value set to them.
Inserting Labels
We can decide to use the DITA
<keyword>
element with a certain
@outputclass
attribute value set to label
to
insert such keywords that should be displayed in the published
output.<topic id="topicID">
<title>DITA 1.3 Features</title>
<prolog>
<metadata>
<keywords>
<keyword outputclass="label">DITA 1.3</keyword>
</keywords>
</metadata>
</prolog>...
To make the insertion of such labels easier, you can, for example, create a custom Author action that inserts the labels and add the custom action to the content completion window: Adding a Custom Author Action to the Content Completion Window.
To have special styling for the inserted labels when editing, you can customize the CSS stylesheets used for DITA editing: Customizing the DITA Visual Editing Experience.
Factoring Labels When Publishing
The WebHelp publishing by default creates visual labels in the published output.