html-customization-navigation.dita 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
  3. <!-- This file is part of the DITA Open Toolkit project. See the accompanying LICENSE file for applicable license. -->
  4. <task id="custom-html-navigation">
  5. <title>Adding navigation to topics</title>
  6. <titlealts>
  7. <navtitle>Adding navigation</navtitle>
  8. </titlealts>
  9. <shortdesc>In HTML5 output, you can set a parameter to include table-of-contents navigation in the
  10. <xmlelement>nav</xmlelement> element of each page. The navigation can be rendered in a sidebar or menu via
  11. CSS.</shortdesc>
  12. <taskbody>
  13. <context>
  14. <p>Earlier versions of DITA-OT used the TocJS transformation to render a JavaScript-based table of contents in an
  15. XHTML frameset for topic navigation. While this approach is still supported for XHTML output, recent toolkit
  16. versions provide a modern HTML5 navigation alternative.</p>
  17. <p>As of DITA-OT 2.2, the <parmname>nav-toc</parmname> parameter can be used in HTML5 transformations to embed
  18. navigation directly in topics using native HTML5 elements without JavaScript or framesets.</p></context>
  19. <steps>
  20. <step>
  21. <cmd>Set the <parmname>nav-toc</parmname> parameter to one of the following options:</cmd>
  22. <choices>
  23. <choice>The <option>partial</option> option creates a table of contents with the portion of the navigation
  24. hierarchy that contains the current topic (along with its parents, siblings and children).</choice>
  25. <choice>The <option>full</option> option embeds the complete navigation for the entire map in each
  26. topic.</choice>
  27. </choices>
  28. </step>
  29. <step importance="optional">
  30. <cmd>Add custom CSS rules to style the navigation.</cmd>
  31. <info>
  32. <p>For example, the DITA-OT documentation stylesheet includes the following rules to place the table of
  33. contents on the left side of the browser viewport and highlight the current topic in bold:
  34. <codeblock><coderef href="../resources/dita-ot-doc.css#token=nav-coderef,end-nav-ref"/></codeblock>
  35. </p>
  36. </info>
  37. </step>
  38. </steps>
  39. <result>
  40. <note type="tip">For an example of HTML output generated using this method, see the HTML5 version of the DITA-OT
  41. documentation included in the installation folder under <filepath>doc/index.html</filepath>.</note>
  42. </result>
  43. </taskbody>
  44. </task>