Links

Links allow the users to navigate through the documentation.

Parent topic: Styling the Content
Previous topic: Lists
Next topic: Images and Figures

How to Change 'on page NNN' Link Label

For printed material, it is usually desirable for the links to display a label after the text content (such as "on page 54"). This makes it easier the user to identify the target page. However, if the produced PDF is not printed and is intended only for electronic use, this label may create clutter and make the document harder to read. To eliminate this label, you can simply disable the args.css.param.show-onpage-lbl parameter.

This can also be done by adding the following in your customization CSS:

*[class ~= "topic/xref"][href]:after,
*[class ~= "topic/link"][href]:after {
    content: none !important;
}
Note: A variant is to remove the "on page" label only and keep the page number:
*[class ~= "topic/xref"][href]:after,
*[class ~= "topic/link"][href]:after {
    content: " (" target-counter(attr(href), page) ")" !important;
}

Another use-case is to remove the labels only from links shown in tables cells, and leave the others as they are. For this, you could use a more specific selector:

*[class ~= "topic/entry"] *[class ~= "topic/xref"][href]:after{
    content: none !important;
}

How to Change Link Styles

Suppose you want the links to be bold and with an underline. In your customization CSS, add this snippet:

*[class ~= "topic/xref"][href]:after,
*[class ~= "topic/link"][href]:after {
    font-weight: bold;
    text-decoration: underline;
}

How to Hide Descriptions in Related Links Sections

The link descriptions that come from DITA relationship tables or related link elements within topics, are structured in the merged map like this:

<related-links class="- topic/related-links ">
   <linkpool class="- topic/linkpool ">
        <link class="- topic/link " 
            ...
               role="friend" scope="local" type="topic">
                <linktext class="- topic/linktext ">Salvia</linktext>
                <desc class="- topic/desc ">The salvia plant</desc>
          </link>
    </linkpool>
    ...
</related-links>

If you need to hide these descriptions, add the following code in your customization CSS:

*[class ~= "topic/link"] > *[class ~= "topic/desc"] {
  display: none;
}

How to Group Related Links by Type

By default, all links from DITA relationship tables or related link elements within topics are grouped under one "Related information" heading:
Related information
  Target Topic
  Target Concept
  Target Task
It is possible to group the links by target type (topic type) by setting the args.rellinks.group.mode=group-by-type parameter. The output will look like this:
Related concepts
  Target Concept
Related tasks
  Target Task
Related information
  Target Topic