SiteParam
The siteparam
shortcode prints values of site params.
Usage
While the examples are using shortcodes with named parameter you are free to use positional as well or call this shortcode from your own partials.
{{% siteparam name="editURL" %}}
{{% siteparam "editURL" %}}
{{ partial "shortcodes/siteparam.html" (dict
"page" .
"name" "editURL"
)}}
Parameter
Name | Position | Default | Notes |
---|---|---|---|
name | 1 | <empty> | The name of the site param to be displayed. |
Examples
editURL
from hugo.toml
`editURL` value: {{% siteparam name="editURL" %}}
editURL
value: https://github.com/russfeld/ksucs-hugo/edit/master/content/${FilePath}
Nested parameter with Markdown and HTML formatting
To use formatted parameter, add this in your hugo.toml
:
hugo.
[markup]
[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true
markup:
goldmark:
renderer:
unsafe: true
{
"markup": {
"goldmark": {
"renderer": {
"unsafe": true
}
}
}
}
Now values containing Markdown will be formatted correctly.
hugo.
[params]
[params.siteparam]
[params.siteparam.test]
text = 'A **nested** parameter <b>with</b> formatting'
params:
siteparam:
test:
text: A **nested** parameter <b>with</b> formatting
{
"params": {
"siteparam": {
"test": {
"text": "A **nested** parameter \u003cb\u003ewith\u003c/b\u003e formatting"
}
}
}
}
Formatted parameter: {{% siteparam name="siteparam.test.text" %}}
Formatted parameter: