blob: 0e648efaa62e70cddebc54c6e136c73ee012c91f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
---
title: OutputFormats
description: Returns a slice of OutputFormat objects, each representing one of the output formats enabled for the given page.
categories: []
keywords: []
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](/configuration/output-formats/).
## Methods
{{% 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" }}
<a href="{{ .RelPermalink }}">RSS Feed</a>
{{ end }}
```
On the site's home page, Hugo renders this to:
```html
<a href="/index.xml">RSS Feed</a>
```
Please see the [link to output formats] section to understand the importance of the construct above.
[link to output formats]: /configuration/output-formats/#link-to-output-formats
|