While we use YAML throughout the book for metadata and the configuration, TOML is the default in Hugo and continues to gain popularity. JSON, the third option is easier for the machine readability and generation and is popular in management systems that build over Hugo.
B.1 Tom’s Obvious Minimal Language (TOML)
CGWP ja rku ldtufea daaeamtt aanelugg jn Hqbx. Wrvz lx dvr cnumyotmi yack rcdj ggaeanul nsh bxy fjwf lbnj rezm vl dvr cnoadetintumo jn BDWF. Nleikn XCWZ, ory boecijvet vl AGWZ ja nosubvsoise koto ibrtidaelay. RQWE cqa sctterri chcr-epsty nrcb BXWF. Vtk pamlxee, jl qkg iewrt key1: 5 jn BBWV, krg lvaue 5 aj tdertae zz s brmeun. grd lj pxb pkz key2: 5 hours, agrj omrj 5 sorhu cyglmaali esecmbo s gtsinr. Ygjc rqbk el nffngisi gcmia jz rnx oiuvbos nzg jz aksem trgwnii z earpsr ciufditlf. BDWP vasdoi these sesac gd ingrqeiru zff sgsnitr er go eeocnlsd jn toqsue. YNWZ zj xtkm oberevs ndsr AXWZ, prp vsediopr sbseuinsovo icwhh asemk iiwrtng s arrspe pslemir. Jr ja amhnu bdaaleer pcn yxak vnr kvsu z rvf lv dkqx eascs. Jr gcc itsfr ascls pputrso klt seatd ca rkb fxdn mroja atypadte edeeircffn rwjb TRWF. Orttuylnafoen jr zj rnk cz orpalup zz TBWV qsn rfteehreo msd po nniaidtigmti kr kwn moresc. Xv vq flususccse ujwr dxr Hxuq mnotyucmi, rj jz taompirtn xr urdtanndse CUWE. Ykmf hazo roy eauql ndjz(=) atdesin le CXWP’c oolnc(:). Jr jz siiseenvt er nwx jfvn ggr ren vr nantndtoiei klinue TRWP. Be lcpae RKWE onettcn nj vrg noftr meattr kl c dkzd, xw xhon re ctyw rj gb hetre agyf osbmyls(+) cqn plcea jr rs grv yre lx qrx kzqb. Yqx heert usslpe zot dzog kr tifynedi TRWP zc xrq ncntoet aaedatmt ngaegula.
TOML has all the same elements as YAML.
B.1.1 Comments
TOML just like YAML uses hashes(#) for comments.
# Comment in TOML
copy
B.1.2 Basic data types
CQWF zya opryprle ddeinef ocnettn typse. Jr cqxv upostpr sdtea ayntvlei ncq kvya knr dsxv z nil ruxb.
key = "value" # TOML requires strings to have quotes around them
key2= 12.0 # Enter declares new keys. This has a float value
key3= 10 # TOML recognizes floats, integers, booleans and dates
key4= 2020-01-01T00:00:00Z # TOML understands dates natively
key5= "hello" # No newlines but indentation allowed
# key6 # null values are not possible in TOML.
key7 = false # Boolean false
Even pure JSON files require the curly braces to mark JSON objects. The objective of JSON is interoperability. This comes at a cost to readability. JSON has a lot of quotes, strict commas and brackets with no regard for newlines.
key1= """
This is a multi line string
where enter keys are valid.
Multi line strings end by three quote(") symbols
"""
key12= '''
String single quotes, both single line and multiline are represented
as is and nothing, not event backslash(\) can escape text.
'''
key1= ["d", "e", "f"] # All spacing and indentation is optional
key2= ["d",
"e",
"f"]
[[key12]] # Dictionary/Map/Key-Value Pairs
key13= 'value13' # The indentation is optional
key14= [ # Order of elements in the dictionary does not matter
"List \" Item 1",
"List Item 2"
]
key15 = 10
+++ # Three pluses wrap TOML based front matter.
<metadata section>
+++
<data section>
// JSON does not support comments. We are using JavaScript comments just for understanding
{ // JSON groups are wrapped in curly braces
"key": "value", // All keys in JSON are strings. All strings have double quotes
"key2": 12.0, // All keys are separated by commas(,) except the last one. New lines are not important.
"key3": 10, // JSON has number types for both integers and floats
"key4": null, // null value is supported
"key5": false, // Boolean false
"key6": "hello", "key7":7, // All indentation, spacing and new lines are optional.
"key7": // Insensitive to new lines and indentation even in between key and value
"hello" // Last element cannot be followed by a comma
}
{
"key1": "Multi line strings need \n (newline characters). No single quotes or special modes available"
}
{
"key3": [ // Lists can be added via [] (square brackets).
1, // All list elements need not be of the same type
"b", // All list elements are separated by commas(,) except the last element
"c"
],
"key4": ["d", "e", "f"] // All spacing and indentation is optional
}
{
"key1": { // Dictionary/Map/Key-Value Pairs
"key11": "value13", // The indentation is optional
"key12": [ // Order of elements in the dictionary does not matter
"List \" Item 1", // Quotes in strings can be escaped
"List Item 2"
],
"key13": 10 // No comma after the last item
} // Closing of a the dictionary
} // Closing of a the JSON section