summaryrefslogtreecommitdiffstats
path: root/docs/content/en/functions/param.md
blob: 5387647d20addc7bc0b0783594ecf116b0aaf42e (plain)
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
39
40
---
title: .Param
description: Calls page or site variables into your template.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-04-30
keywords: ["front matter"]
categories: [functions]
menu:
  docs:
    parent: "functions"
toc:
signature: [".Param KEY"]
workson: []
hugoversion:
relatedfuncs: [default]
deprecated: false
draft: false
aliases: []
---

In Hugo, you can declare [site-wide params][sitevars] (i.e. in your [configuration]), as well as params for [individual pages][pagevars].

A common use case is to have a general value for the site and a more specific value for some of the pages (e.g., an image).

You can use the `.Param` method to call these values into your template. The following will first look for an `image` param in a specific content's [front matter]. If not found, Hugo will look for an `image` param in your site's configuration:

```
$.Param "image"
```

{{% note %}}
The `Param` method may not consider empty strings in a content's front matter as "not found." If you are setting preconfigured front matter fields to empty strings using Hugo's archetypes, it may be best to use the [`default` function](/functions/default/) instead of `Param`. See the [related issue on GitHub](https://github.com/gohugoio/hugo/issues/3366).
{{% /note %}}


[configuration]: /getting-started/configuration/
[front matter]: /content-management/front-matter/
[pagevars]: /variables/page/
[sitevars]: /variables/site/