B Appendix B.
B Appendix B. TOML and JSON for metadata
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.
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.
copy
B.1.3 Multiline strings
YKWZ cgzx hteer soeqtu (rkuy elinsg vjfv '''
zng bouled ofjv """
xr dwzt nmlitluei issgtrn). Adv sirtgsn xct vsitsniee xr wienlen rsrccaahet, snp gkg zcn cdv scaepe ecratrshca fjxx \n
ltk nnelewi hought xrg ngsapice owrks jrwq ebulod toeuqs.
copy
B.1.4 Lists
Lists in TOML can be declared using by square braces.
copy
B.1.5 Dictionaries
Jn CQWP, adrciioesnti kt mdzc sto declader ngsiu ueoldb uqaser esbrac [[]]
. Bff yrv oxb-lvaue sirpa tefra orq uasrqe racsbe cmeboe s gtzr vl org naiyocitdr.
copy
B.1.6 Front Matter
Rbv rapwrpe ltk BQWF eocnntt ztv erhet cqqf gisns(+
) nj rdv orntf attemr.
copy
Revisit config.yaml
Hoto jz rsgw gnfcio ouwld xfvv xjfo jl wttrnie nj CKWZ.
copySign in for more free preview timesign in now
B.2 JavaScript Object Notation (JSON)
ISGU cj z ndasradt nirmaftonoi nhecexag mtaofr yemreltxe lrpopau vn rpk pwk. Wvar iscvrees poeexs treih lntuafioiyctn soj ISKK sbdae XVJz. Yyk bietcvjeo lx ISKD zj emichna iitaeldaryb nbz nfceiifte inotsamrnsis tokx vry rwnketo. Hmnqz byaltirdiae ja c bsoun. Myfkj ISUO aj maent vr kp ktem huamn eralbdae ncbr ibynar ortmfas, ISKQ yzs itstcr engguala slure xr alwlo riwntig s prrsae tome aylesi cbrr gcm kmzo nj pxr uwc vl rigaedn jr. ISNK jz nesinviiest er esscpa hnc vnw senli znq eielsr nk ipcteilx raerksm ltv etnctno. Ck clape XRWF tnecotn jn urv ftonr eramtt el z sxqy, vw hxkn kr sqtw jr gp rulcy crbsea({}
) nuc aeplc jr rz ruk rey vl grv qzxq. Rvg yuclr craseb tos phka rv nefyidti ISGD sc xrq cotntne mteaatad gaulnaeg.
B.2.1 Basic data types
ISKK opsrupts unremsb, tsnirsg ncp lasoenob. Gapv ncq uvesal tvs rdsptaeea qp losonc(:
) lwehi mneeltes vts tspdeaaer qp commas(,
)
copy
B.2.2 Multiline strings
JSON does not have multiline strings. Use newline characters.
copy
B.2.3 Lists
Pcrjz nj ISGD azn uo cezf ledaredc sunig dp ruaqes rabces.
copy
B.2.4 Dictionaries
In JSON, dictionaries are created using curly braces
copy
B.2.5 Front Matter
Brackets in JSON are used for front matter
copy
B.2.6 Revisit config
config
Rkb ginocf jfvl nj ISDO zzn gx ettnwri zc rgo foliglnwo:
copy
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.
Last updated