html-customization-header.dita 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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>
  18. <indexterm>HTML header</indexterm>
  19. <indexterm>HTML footer</indexterm></indexterm>
  20. <indexterm><xmlatt>role</xmlatt></indexterm>
  21. <indexterm>HTML5
  22. <indexterm>headers</indexterm></indexterm>
  23. <indexterm>HTML5
  24. <indexterm>footers</indexterm></indexterm>
  25. <indexterm>CSS
  26. <indexterm>adding custom</indexterm></indexterm>
  27. <indexterm>CSS
  28. <indexterm>HTML5</indexterm></indexterm>
  29. <indexterm>HTML5
  30. <indexterm>CSS</indexterm></indexterm>
  31. </keywords>
  32. </metadata>
  33. </prolog>
  34. <taskbody>
  35. <context>
  36. <p>In HTML5 output, the contents of the header file will be wrapped in an HTML5 <xmlelement>header</xmlelement>
  37. element with the <xmlatt>role</xmlatt> attribute set to <option>banner</option>. The footer file contents are
  38. wrapped in an HTML5 <xmlelement>footer</xmlelement> element with the <xmlatt>role</xmlatt> attribute set to
  39. <option>contentinfo</option>.</p>
  40. <p>For example, the DITA-OT documentation includes a simple header banner with the publication title and a
  41. horizontal rule to separate the header from the generated topic content: </p>
  42. <p><codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace"><coderef href="../resources/header.xml"/></codeblock>
  43. </p>
  44. <note>Header and footer files should be specified using absolute paths and must contain valid XML. A common
  45. practice is to place all content into a <xmlelement>div</xmlelement> element.</note>
  46. </context>
  47. <steps>
  48. <step>
  49. <cmd>Set <parmname>args.hdr</parmname> to include an XML file as a running header that appears above the page
  50. content.</cmd>
  51. <info> </info>
  52. </step>
  53. <step>
  54. <cmd>Set <parmname>args.ftr</parmname> to include an XML file as a running footer that appears below the page
  55. content.</cmd>
  56. </step>
  57. <step importance="optional">
  58. <cmd>Add custom CSS rules to style headers and/or footers.</cmd>
  59. <info>
  60. <p>For example, the DITA-OT documentation stylesheet includes the following header rules: </p>
  61. <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>
  62. </p>
  63. </info>
  64. </step>
  65. </steps>
  66. <result>
  67. <note type="tip">For an example of HTML output generated using this method, see the HTML5 version of the DITA-OT
  68. documentation included in the installation folder under <filepath>doc/index.html</filepath>.</note>
  69. </result>
  70. </taskbody>
  71. </task>