html-customization-header.dita 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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-header">
  5. <title>Adding custom headers and footers</title>
  6. <titlealts>
  7. <navtitle>Headers and footers</navtitle>
  8. </titlealts>
  9. <shortdesc>You add a custom header to include a publication title, company logo, or other common branding elements in
  10. HTML output. A custom footer can also be added with copyright information, legal boilerplate, or other fine
  11. print.</shortdesc>
  12. <prolog>
  13. <metadata>
  14. <keywords>
  15. <indexterm><xmlelement>header</xmlelement></indexterm>
  16. <indexterm><xmlelement>footer</xmlelement></indexterm>
  17. <indexterm><xmlelement>div</xmlelement><indexterm>HTML header</indexterm><indexterm>HTML footer</indexterm></indexterm>
  18. <indexterm><xmlatt>role</xmlatt></indexterm>
  19. <indexterm>HTML5<indexterm>headers</indexterm></indexterm>
  20. <indexterm>HTML5<indexterm>footers</indexterm></indexterm>
  21. <indexterm>CSS<indexterm>adding custom</indexterm></indexterm>
  22. <indexterm>CSS<indexterm>HTML5</indexterm></indexterm>
  23. <indexterm>HTML5<indexterm>CSS</indexterm></indexterm>
  24. </keywords>
  25. </metadata>
  26. </prolog>
  27. <taskbody>
  28. <context>
  29. <p>In HTML5 output, the contents of the header file will be wrapped in an HTML5 <xmlelement>header</xmlelement>
  30. element with the <xmlatt>role</xmlatt> attribute set to <option>banner</option>. The footer file contents are
  31. wrapped in an HTML5 <xmlelement>footer</xmlelement> element with the <xmlatt>role</xmlatt> attribute set to
  32. <option>contentinfo</option>.</p>
  33. <p>For example, the DITA-OT documentation includes a simple header banner with the publication title and a
  34. horizontal rule to separate the header from the generated topic content: </p>
  35. <p><codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace"><coderef href="../resources/header.xml"/></codeblock>
  36. </p>
  37. <note>Header and footer files should be specified using absolute paths and must contain valid XML. A common
  38. practice is to place all content into a <xmlelement>div</xmlelement> element.</note>
  39. </context>
  40. <steps>
  41. <step>
  42. <cmd>Set <parmname>args.hdr</parmname> to include an XML file as a running header that appears above the page
  43. content.</cmd>
  44. <info> </info>
  45. </step>
  46. <step>
  47. <cmd>Set <parmname>args.ftr</parmname> to include an XML file as a running footer that appears below the page
  48. content.</cmd>
  49. </step>
  50. <step importance="optional">
  51. <cmd>Add custom CSS rules to style headers and/or footers.</cmd>
  52. <info>
  53. <p>For example, the DITA-OT documentation stylesheet includes the following header rules: </p>
  54. <p><codeblock outputclass="language-css normalize-space show-line-numbers show-whitespace"><coderef href="../resources/dita-ot-doc.css#token=header-coderef,end-header-ref"/></codeblock>
  55. </p>
  56. </info>
  57. </step>
  58. </steps>
  59. <result>
  60. <note type="tip">For an example of HTML output generated using this method, see the HTML5 version of the DITA-OT
  61. documentation included in the installation folder under <filepath>doc/index.html</filepath>.</note>
  62. </result>
  63. </taskbody>
  64. </task>