Add `.OutputFormat` to the page object
Author: regisphilibertCreated Jan 10, 2022Updated Sep 26, 2026
LabelsProposalb0
There is at the moment no built-in solution to simply retrieve the current output format object of a given "page" or template.
Currently user has to compare .AlternateOutputFormats with a list of defined outputs and isolate the missing one. I understand the complexity as output formats are sharing the same content file, but if we have .AlternateOuputFormats, I suppose we are able to retrieve the current one?
{{ if eq .OutputFormat.Name "debug_data" }}
{{ <meta name="robots" content="noindex"> }}
{{ end }}Source: gohugoio/hugo