html-customization-navigation.dita 3.2 KB

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