key1: value1 key2: value2
HIDDEN[1]
YAML is a configuration language and data-serialization format that can include Atoms, Maps and Lists.[2]
Atoms are the elementary particles of a YAML serialization. An atom is usually either…
a boolean (e.g. true
or false
),
a number
(e.g. 2
or
2.718281828
),
or
a string (e.g. hello world
).
A map is a key-value pair. Here are a couple example YAML maps:
key1: value1 key2: value2
Here is an example of a YAML list:
- item1 - item2 - item3
These data structures can have names, also known as keys. For example:
name1: key1: value1 key2: value2 name2: - item1 - item2 - item3
Note that
name1
is a key whose value is a couple maps
and
name2
is a key whose value is a
three-item
list.
Naming a collection is a way to turn
it
into a
block
or
object
(with sub-objects)
that can be referenced.
In general, you do not need to use quotation marks around YAML strings. Quoting a string is required if it…
includes a
colon (:
),
hash (#
),
greater than (>
),
or any character that has a special meaning in YAML,
looks like a number (decimal, hexadecimal, exponential E
or e
notation, etc.),
or is one of YAML’s reserved boolean words (true, false, no, off, etc.).[3]
‼ | In YAML:
|
An atom is also known as a scalar.
A list is also known as an array, a sequence, a slice, or a vector.
A
named collection of maps,
for example name1
,
is also known as
an associative array,
a dictionary,
a dict,
a hash table,
a hash,
a keyed list,
a map,
a mapping,
a named map,
a nested map,
an object,
a record,
a struct,
or
a table.
The following Infinite Ink pages include YAML settings that can be used in a Hugo config file.