Shortcode Params

Describe the parameter definitions of the Hugo shortcode, which is useful for writing shortcode's documentation.

Syntax

1{{% hugo/shortcode-params [data] %}}

Parameters

data

PositionNameTypeRequiredDefaultSinceExample
#0datastring---

The data filename.

heading

PositionNameTypeRequiredDefaultSinceExample
-headingstring-Parameters--

The heading.

headingStartLevel

PositionNameTypeRequiredDefaultSinceExample
-headingStartLevelnumber-2--

The heading start level.

Data Item Properties

name

NameContextTypeRequiredDefaultSinceExample
name-string---

The parameter name.

position

NameContextTypeRequiredDefaultSinceExample
position-number----

The index of positional parameter.

type

NameContextTypeRequiredDefaultSinceExample
type-string/array-string--

The type of parameter.

required

NameContextTypeRequiredDefaultSinceExample
required-boolean-false--

Indicates whether if the parameter is required.

default

NameContextTypeRequiredDefaultSinceExample
default-string----

The default value of parameter.

since

NameContextTypeRequiredDefaultSinceExample
since-string----

Indicates the version in which the parameter is added.

description

NameContextTypeRequiredDefaultSinceExample
description-string/object---

The description, support Markdown.

description.default

NameContextTypeRequiredDefaultSinceExample
description.default-string----

The default description.

description.[lang]

NameContextTypeRequiredDefaultSinceExample
description.[lang]-string----

Language-specific description.

options

NameContextTypeRequiredDefaultSinceExample
options-array----

Available options.

deprecated

NameContextTypeRequiredDefaultSinceExample
deprecated-string-false--

Indicates whether if the parameter is deprecated.

Example

data/example-params.yaml
 1- name: foo
 2  position: 0
 3  required: true
 4  description:
 5    default: Foo description.
 6    zh-hans: Foo 描述。
 7    zh-hant: Foo 描述。
 8
 9- name: bar
10  type: number
11  since: v0.2.0
12  deprecated: true
13  description:
14    default: Bar description.
15    zh-hans: Bar 描述。
16    zh-hant: Bar 描述。
17
18- name: fizz
19  description: Single description without translations.
20  options:
21    - one
22    - two

Result as follows.

Source
1{{% hugo/shortcode-params data="data/example-params.yaml" heading="Example Parameters" headingStartLevel=3 %}}
Result

Example Parameters

foo

PositionNameTypeRequiredDefaultSinceExample
#0foostring---

Foo description.

bar

PositionNameTypeRequiredDefaultSinceExample
-barnumber--v0.2.0-

Bar description.

fizz

PositionNameTypeRequiredDefaultSinceExample
-fizzstring----

Single description without translations.

Available options: one, two.