mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-30 03:03:09 +00:00
75 lines
1.5 KiB
Markdown
75 lines
1.5 KiB
Markdown
+++
|
|
categories = ["howto", "reference"]
|
|
description = "Get value of site params"
|
|
title = "SiteParam"
|
|
+++
|
|
|
|
The `siteparam` shortcode prints values of params contained in your `hugo.toml`.
|
|
|
|
## Usage
|
|
|
|
{{< tabs groupid="shortcode-parameter">}}
|
|
{{% tab title="shortcode" %}}
|
|
|
|
````go
|
|
{{%/* siteparam name="editURL" */%}}
|
|
````
|
|
|
|
{{% /tab %}}
|
|
{{% tab title="shortcode (positional)" %}}
|
|
|
|
````go
|
|
{{%/* siteparam "editURL" */%}}
|
|
````
|
|
|
|
{{% /tab %}}
|
|
{{% tab title="partial" %}}
|
|
|
|
````go
|
|
{{ partial "shortcodes/siteparam.html" (dict
|
|
"page" .
|
|
"name" "editURL"
|
|
)}}
|
|
````
|
|
|
|
{{% /tab %}}
|
|
{{< /tabs >}}
|
|
|
|
### Parameter
|
|
|
|
| Name | Position | Default | Notes |
|
|
|----------------------|----------|------------------|-------------|
|
|
| **name** | 1 | _<empty>_ | The name of the site param to be displayed. |
|
|
|
|
## Examples
|
|
|
|
### `editURL`
|
|
|
|
```go
|
|
`editURL` value: {{%/* siteparam name="editURL" */%}}
|
|
```
|
|
|
|
`editURL` value: {{% siteparam name="editURL" %}}
|
|
|
|
### Nested Parameter with Markdown and HTML Formatting
|
|
|
|
To use formatted parameter, add this in your `hugo.toml`:
|
|
|
|
{{< multiconfig file=hugo >}}
|
|
[markup.goldmark.renderer]
|
|
unsafe = true
|
|
{{< /multiconfig >}}
|
|
|
|
Now values containing Markdown will be formatted correctly.
|
|
|
|
{{< multiconfig file=hugo >}}
|
|
[params]
|
|
[params.siteparam.test]
|
|
text = 'A **nested** parameter <b>with</b> formatting'
|
|
{{< /multiconfig >}}
|
|
|
|
```go
|
|
Formatted parameter: {{%/* siteparam name="siteparam.test.text" */%}}
|
|
```
|
|
|
|
Formatted parameter: {{% siteparam name="siteparam.test.text" %}}
|