Print support

Configure printable pages and whole-section print output.

Individual documentation pages print well from most browsers as the layouts have been styled to omit navigational chrome from the printed output.

On some sites, it can be useful to enable a “print entire section” feature (as seen in this user guide). Selecting this option renders the entire current top-level section (such as Advanced for this page) with all of its child pages and sections in a format suited to printing, complete with a table of contents for the section.

To enable this feature, add the “print” output format in your site’s hugo.toml/hugo.yaml/hugo.json file for the “section” type:

Configuration file:
hugo.toml
TOML

[outputs]
section = [ "HTML", "RSS", "print" ]
hugo.yaml
YAML

outputs:
  section:
    - HTML
    - RSS
    - print
hugo.json
JSON

{
  "outputs": {
    "section": [
      "HTML",
      "RSS",
      "print"
    ]
  }
}

The site should then show a “Print entire section” link in the right hand navigation.

Further Customization

Disabling the ToC

To disable showing the table of contents in the printable view, set the disable_toc param to true, either in the page front matter, or in hugo.toml/hugo.yaml/hugo.json:

Front matter:
FRONT MATTER:
toml
TOML

+++

disable_toc = true

+++
yaml
YAML

---

disable_toc: true

---
json
JSON

{
  …,
  "disable_toc": true,
  
}
Config file:
hugo.toml
TOML

[params.print]
disable_toc = true
hugo.yaml
YAML

params:
  print:
    disable_toc: true
hugo.json
JSON

{
  "params": {
    "print": {
      "disable_toc": true
    }
  }
}

Layout hooks

A number of layout partials and hooks are defined that can be used to customize the printed format. These can be found in layouts/_partials/print.

Hooks can be defined on a per-type basis. For example, you may want to customize the layouts of heading for “blog” pages vs “docs”. This can be achieved by creating layouts/_partials/print/page-heading-<type>.html such as page-heading-blog.html. It defaults to using the page title and description as a heading.

Similarly, the formatting for each page can be customized by creating layouts/_partials/print/content-<type>.html.