hugo-theme-relearn/exampleSite/content/shortcodes/siteparam.en.md
Sören Weber e4e750c1cc
docs: chapter 3 content-complete #567
add other stuff
2024-10-12 18:38:04 +02:00

1.5 KiB

+++ 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" %}}

{{%/* siteparam name="editURL" */%}}

{{% /tab %}} {{% tab title="shortcode (positional)" %}}

{{%/* siteparam "editURL" */%}}

{{% /tab %}} {{% tab title="partial" %}}

{{ 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

`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 with formatting' {{< /multiconfig >}}

Formatted parameter: {{%/* siteparam name="siteparam.test.text" */%}}

Formatted parameter: {{% siteparam name="siteparam.test.text" %}}