Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'

This commit is contained in:
Bjørn Erik Pedersen
2025-04-10 13:04:51 +02:00
987 changed files with 12379 additions and 14083 deletions

View File

@@ -3,28 +3,26 @@ title: OutputFormats
description: Returns a slice of OutputFormat objects, each representing one of the output formats enabled for the given page.
categories: []
keywords: []
action:
related:
- methods/page/AlternativeOutputFormats
returnType: '[]OutputFormat'
signatures: [PAGE.OutputFormats]
toc: true
params:
functions_and_methods:
returnType: '[]OutputFormat'
signatures: [PAGE.OutputFormats]
---
{{% glossary-term "output format" %}}
The `OutputFormats` method on a `Page` object returns a slice of `OutputFormat` objects, each representing one of the output formats enabled for the given page. See [details](/templates/output-formats/).
The `OutputFormats` method on a `Page` object returns a slice of `OutputFormat` objects, each representing one of the output formats enabled for the given page. See [details](/configuration/output-formats/).
## Methods
{{% include "methods/page/_common/output-format-methods.md" %}}
{{% include "/_common/methods/page/output-format-methods.md" %}}
## Example
To link to the RSS feed for the current page:
```go-html-template
{{ with .OutputFormats.Get "rss" -}}
{{ with .OutputFormats.Get "rss" }}
<a href="{{ .RelPermalink }}">RSS Feed</a>
{{ end }}
```
@@ -37,4 +35,4 @@ On the site's home page, Hugo renders this to:
Please see the [link to output formats] section to understand the importance of the construct above.
[link to output formats]: /templates/output-formats/#link-to-output-formats
[link to output formats]: /configuration/output-formats/#link-to-output-formats