How to use custom output formats to create a printer-friendly template
I would like to be able to define an HTML template that is optimized for printing. It would seem that Hugo custom output formats is exactly what I need but I am struggling to understand how to make it work.
Here is an excerpt from the config.yaml
file that defines the new format:
outputFormats:
printFormat:
name: print
mediaType: text/html
isHTML: true
path: print
outputs:
page:
- HTML
- print
home:
- HTML
- RSS
section:
- HTML
- RSS
taxonomy:
- HTML
- RSS
term:
- HTML
- RSS
I’ve also created <theme>/layouts/_default/baseof.print.html
and <theme>/layouts/_default/single.print.html
.
I don’t get any errors when I try to build, however I also don’t see any of the print templates generated.
I also don’t fully understand what the url structure would look like to target the resource. Here is what I’ve tried
https://<domain-name>/posts/<post-name>.print
https://<domain-name>/posts/<post-name>.print.html
https://<domain-name>/posts/print/<post-name>
https://<domain-name>/posts/<post-name>/print/index.html
Can someone help me understand what I am doing wrong in the configuration and what the URL would look like to access the custom out put?