mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-31 02:32:37 +00:00
Update Output Formats
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
b069d7f84f
commit
18114d4b4a
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Custom Output Formats
|
||||
linktitle: Custom Output Formats
|
||||
description: Hugo can output content in multiple formats, including calendar events, e-book formats, Google AMP, and JSON search indexes, or any custom text format.
|
||||
description: Hugo can output content in multiple formats, including calendar events, e-book formats, Google AMP, and JSON search indexes, or any custom text format.
|
||||
date: 2017-03-22
|
||||
publishdate: 2017-03-22
|
||||
lastmod: 2017-03-22
|
||||
@@ -60,11 +60,11 @@ suffix = "htm"
|
||||
mediaType = "text/html"
|
||||
```
|
||||
|
||||
**Note** that for the above to work, you also need to add an`outputs` definition in your site config.
|
||||
**Note** that for the above to work, you also need to add an `outputs` definition in your site config.
|
||||
|
||||
## Output Formats
|
||||
## Output Format Definitions
|
||||
|
||||
Given a media type and some additional configuration, you get an `Output Format`:
|
||||
Given a media type and some additional configuration, you get an **Output Format**.
|
||||
|
||||
This is the full set of Hugo's built-in output formats:
|
||||
|
||||
@@ -122,9 +122,26 @@ The following is the full list of configuration options for output formats and t
|
||||
|
||||
## Output Formats for Pages
|
||||
|
||||
A `Page` in Hugo can be rendered to multiple representations on the file system. By default, all pages will render as `HTML` with some of them also as `RSS` (homepage, sections, etc.).
|
||||
A `Page` in Hugo can be rendered to multiple *output formats* on the file
|
||||
system.
|
||||
|
||||
This can be changed by defining an `outputs` list of output formats in either the `Page` front matter or in the site configuration (either for all sites or per language).
|
||||
### Default Output Formats
|
||||
Every `Page` has a [`Kind`][page_kinds] attribute, and the default Output
|
||||
Formats are set based on that.
|
||||
|
||||
| Kind | Default Output Formats |
|
||||
|--------------- |----------------------- |
|
||||
| `page` | HTML |
|
||||
| `home` | HTML, RSS |
|
||||
| `section` | HTML, RSS |
|
||||
| `taxonomyTerm` | HTML, RSS |
|
||||
| `taxonomy` | HTML, RSS |
|
||||
|
||||
### Customizing Output Formats
|
||||
|
||||
This can be changed by defining an `outputs` list of output formats in either
|
||||
the `Page` front matter or in the site configuration (either for all sites or
|
||||
per language).
|
||||
|
||||
Example from site `config.toml`:
|
||||
|
||||
@@ -142,12 +159,14 @@ outputs:
|
||||
page: ["HTML"]
|
||||
```
|
||||
|
||||
Note that in the above examples, the *output formats* for `section`,
|
||||
`taxonomyTerm` and `taxonomy` will stay at their default value `["HTML",
|
||||
"RSS"]`.
|
||||
|
||||
* The output definition is per `Page` `Kind` (i.e, `page`, `home`, `section`, `taxonomy`, or `taxonomyTerm`).
|
||||
* The names used must match the `Name` of a defined `Output Format`.
|
||||
* Any `Kind` without a definition will default to `HTML`.
|
||||
* The `outputs` definition is per [`Page` `Kind`][page_kinds] (`page`, `home`, `section`, `taxonomy`, or `taxonomyTerm`).
|
||||
* The names (e.g. `HTML`, `AMP`) used must match the `Name` of a defined *Output Format*.
|
||||
* These names are case insensitive.
|
||||
* These can be overridden per `Page` in the front matter of content files.
|
||||
* Output formats are case insensitive.
|
||||
|
||||
The following is an example of `YAML` front matter in a content file that defines output formats for the rendered `Page`:
|
||||
|
||||
@@ -222,3 +241,4 @@ The partial below is a plain text template (Outpuf Format is `CSV`, and since th
|
||||
[lookup order]: /templates/lookup/
|
||||
[media type]: https://en.wikipedia.org/wiki/Media_type
|
||||
[partials]: /templates/partials/
|
||||
[page_kinds]: /templates/section-templates/#page-kinds
|
||||
|
||||
Reference in New Issue
Block a user