Debian Codegraph @

docs/content/en/shortcodes/param.md

raw
1 ---
2 title: Param shortcode
3 linkTitle: Param
4 description: Insert a parameter from front matter or your project configuration into your content using the param shortcode.
5 categories: []
6 keywords: []
7 ---
8
9 > [!NOTE]
10 > To override Hugo's embedded `param` shortcode, copy the [source code][] to a file with the same name in the `layouts/_shortcodes` directory.
11
12 The `param` shortcode renders a parameter from front matter, falling back to a site parameter of the same name. The shortcode throws an error if the parameter does not exist.
13
14 ```md {file="content/example.md"}
15 ---
16 title: Example
17 date: 2025-01-15T23:29:46-08:00
18 params:
19 color: red
20 size: medium
21 ---
22
23 We found a {{%/* param "color" */%}} shirt.
24 ```
25
26 Hugo renders this to:
27
28 ```html
29 <p>We found a red shirt.</p>
30 ```
31
32 Access nested values by [chaining](g) the [identifiers](g):
33
34 ```md
35 {{%/* param my.nested.param */%}}
36 ```
37
38 [source code]: <{{% eturl param %}}>