html-customization-navigation.dita 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. <prolog>
  13. <metadata>
  14. <keywords>
  15. <indexterm><xmlelement>nav</xmlelement></indexterm>
  16. <indexterm>HTML5<indexterm>navigation, adding</indexterm></indexterm>
  17. <indexterm>transformations<indexterm>HTML5</indexterm></indexterm>
  18. <indexterm>CSS<indexterm>adding custom</indexterm></indexterm>
  19. <indexterm>nav-toc</indexterm>
  20. <indexterm>HTML5<indexterm>nav-toc</indexterm></indexterm>
  21. <indexterm>table of contents<indexterm>HTML5</indexterm></indexterm>
  22. <indexterm>table of contents<indexterm>nav-toc</indexterm></indexterm>
  23. </keywords>
  24. </metadata>
  25. </prolog>
  26. <taskbody>
  27. <context>
  28. <p>Earlier versions of DITA-OT used the TocJS transformation to render a JavaScript-based table of contents in an
  29. XHTML frameset for topic navigation. While this approach is still supported for XHTML output, recent toolkit
  30. versions provide a modern HTML5 navigation alternative.</p>
  31. <p>As of DITA-OT 2.2, the <parmname>nav-toc</parmname> parameter can be used in HTML5 transformations to embed
  32. navigation directly in topics using native HTML5 elements without JavaScript or framesets.</p></context>
  33. <steps>
  34. <step>
  35. <cmd>Set the <parmname>nav-toc</parmname> parameter to one of the following options:</cmd>
  36. <choices>
  37. <choice>The <option>partial</option> option creates a table of contents with the portion of the navigation
  38. hierarchy that contains the current topic (along with its parents, siblings and children).</choice>
  39. <choice>The <option>full</option> option embeds the complete navigation for the entire map in each
  40. topic.</choice>
  41. </choices>
  42. </step>
  43. <step importance="optional">
  44. <cmd>Add custom CSS rules to style the navigation.</cmd>
  45. <info>
  46. <p>For example, the DITA-OT documentation stylesheet includes the following rules to place the table of
  47. contents on the left side of the browser viewport and highlight the current topic in bold:</p>
  48. <p>
  49. <codeblock outputclass="language-css normalize-space show-line-numbers show-whitespace"><coderef href="../resources/dita-ot-doc.css#token=nav-coderef,end-nav-ref"/></codeblock>
  50. </p>
  51. </info>
  52. </step>
  53. </steps>
  54. <result>
  55. <note type="tip">For an example of HTML output generated using this method, see the HTML5 version of the DITA-OT
  56. documentation included in the installation folder under <filepath>doc/index.html</filepath>.</note>
  57. </result>
  58. </taskbody>
  59. </task>