[oXygen XML Editor Blog] - DITA Linking Strategies |
Posted: 30 Jun 2017 06:11 AM PDT This small tutorial is based on the "DITA Linking Strategies" presentations I made for the DITA Europe 2016 and DITA North America 2017 conferences. It's a general overview about DITA linking possibilities and best practices. Also, it's meant as a continuation of the DITA Reuse Strategies blog post. According to Wikipedia: "A link, is a reference to data that the reader can directly follow either by clicking, tapping, or hovering." Basically, we should regard linking as yet another form of content reuse, except that instead of presenting the content in place, it re-directs the end user to some other resource. I'll start with describing linking at DITA Map level. Map-Level LinkingA DITA Map uses topic references to assemble the content of a publication. <topicref href="installation.dita"> Depending on the output format, the topic reference may be a link in the table of contents for the XHTML-based outputs or it may be interpreted as a content reference for the PDF-based output that generates a single monolith document. So the role of the ChunkingDITA topic modules should be kept as small as possible, but sometimes the end user may need to read more than one topic to achieve a single task. So, when publishing to HTML-based outputs, you will end up asking yourself this question: Should I prefer larger HTML files or more links in the TOC? And you should always consider these two ideas:
For example, if the installation of your product requires installing both a server-side and a client-side component, by using DITA chunking you can choose to have separate DITA topic modules for each of the installation procedures but merge the topics together in the web-based outputs: <map> You can read more about chunking in the DITA 1.3 specification. The DITA Style Guide also has a good overview about why it is preferable to write small topics and then merge them together using the chunking mechanism. Topic-Level LinkingLinks that appear inside topics can be divided into various categories and I'll discuss each of these categories separately. In-Content LinksIn-content links are links added manually in the topic content: <li>See: <xref href="http://www.../" format="html" scope="external"/></li> You should keep in mind that this kind of link is disruptive to the reading experience because when end users encounter them, they need to decide weather to read further on or to follow the link. On the other hand, this may sometimes be a good thing. For example, one of the installation steps may require the end user to download a certain library from an external website before continuing. You can read more about links in general in the DITA 1.3 specification. The DITA Style Guide, written by Tony Self, also discourages the use of in-content links. Related LinksRelated links are placed at the end of the DITA topic and they allow the end user to explore additional resources after the current topic has been read. <related-links> To minimize disruption when reading the content in general, the preferred place where to place links is at the end of the generated HTML page. You can read more about related links in the DITA 1.3 specification. Defining Related Links using Relationship TablesRelated links do not need to be manually added at the end of each topic. You can define relationship tables in the DITA Map: <reltable> These tables can define associations between two or more topics, associations that automatically contribute to the related links creation in the generated HTML output. Here are some benefits of using relationship tables:
You can read more about relationship tables in the DITA 1.3 specification. The DITA Style Guide also recommends using relationship tables. Indirect Links (Key References)All the link samples we've look at so far have been direct links, links that point to the target using the @href attribute. Indirect links require two steps:
Here are some of the benefits of indirect linking:
There is an overview about indirect addressing on the DITA XML Org website. The DITA 1.3 specification also has a chapter about indirect links. Auto-Generated LinksUntil now, I've talked about manually added links, either in the topic or in relationship tables. Using the DITA @collection-type attribute, you can define relationships between parent and child topic references in the DITA Map, relationships that result in automatic links added between them:<topicref href="installation.dita" collection-type="sequence">There are 3 useful types of @collection-type values:
You can read more about auto-generated links in the DITA Style Guide. Conditional Links in Distinct PublicationsYou may publish documentation for multiple products from the same DITA content. Also, you may want to have links point to various targets depending on the product for which you want to publish the documentation. Or, you may want to suppress links completely in certain publications. When using direct linking, you will need to profile each link depending on the publication: Find our more about slicing vegetables: <xref href="slicing_vegetables_for_experts.dita" audience="expert"/>With indirect links, you can define the profiling attributes as DITA Map level: <topicref keys="slicing" href="slicing_vegetables_for_experts.dita" audience="expert"/>and thus, simplify the reference made in the topic content: Find our more about slicing vegetables: <xref keyref="slicing/>. Conditional Links in the Same PublicationUsing DITA 1.3 key scopes, you can reuse a topic multiple times in a DITA Map and have each referenced topic contain links to various target topics. For example, if my preparing_vegetables.dita topic has a link: you can define various key scopes in the DITA Map that bind the "slicing" key to various targets:<link keyref="slicing"/> <topichead navtitle="Cooking for Experts" keyscope="expert"> This previous blog post contains more details about key scopes. Link TextWhen linking to an external resource or to a DITA topic or element, the publishing engine will attempt to deduce the link text from the target context. For example, the link to a DITA topic or element that contains a
Should I leave the link text to be automatically computed or should I set a more friendly text? For internal links to elements that have a title, in general it is more flexible to not set a custom text and let the publishing engine decide one for you. For external links, you should usually specify your custom link text. Should I Link or Should I Reuse?Suppose you want to bring a certain paragraph, note, or section to the end user's attention. If that particular target element is not very large, you should always reuse it (using a content reference) instead of linking to it. ConclusionsAs with all large projects, managing links in a growing DITA project can be problematic, so you need to become organized. As an overview of what we've discussed so far, I suggest the following best practices:
If you want to experiment with the various linking strategies I discussed above, you can find some samples here: https://www.oxygenxml.com/forum/files/linking-strategies-samples.zip. |
You are subscribed to email updates from oXygen XML Editor Blog. To stop receiving these emails, you may unsubscribe now. |
Email delivery powered by Google |
Google Inc., 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |