3. Using Markup for content
This chapter covers:
A walk through of Markdown language and content creation using Markdown
Understanding of Hugo’s extensions to Markdown. These are supported by all Hugo themes.
Understanding the various markup languages supported by Hugo
A walk though of YAML as the language used to provide metadata in a Hugo based website.
An understanding of the various elements of a page’s Front Matter
Hugo supports a variety of markup languages for generating content. Markdown is the most popular amongst them and most widely used. In this chapter we will be formatting the pages we created in the website for Acme Corporation in chapter 2.Get Hugo in Actionbuy ebook for $39.99 $27.99
3.1 Writing content in Markdown
So far we have used plain text to fill up content in our web pages. With plain text, we get no structure and a blob of text is not fun to read. Markdown is a lightweight format for writing easy to read and easy to write documents with support for formatting and structuring content using text based constructs. Created in 2004 by John Gruber and Aaron Swartz, Markdown is built with the objective of being human readable. It standardizes on a text based mechanism for specifying formatting and while a compiler and a renderer improves readability, the language is easy to understand without it. This allows usage of markdown anywhere from the command line to git commit messages, README files, plain text boxes and chat pods.
Gaglirni Wawdkron zpc c dtliemi vcr kl treesfua ichhw agc knod nxeedted hp RmnoomWcto hhwci xry euhrftr neddeetx cc Uthibu Vorlaved Wkrawdno(ULW) chiwh jc ory lpoarpu naaitrv. Hpde urtpsspo kzrm lx UZW chn eesntxd rj onkk utrerhf.
Zxfzj deeartc rjpw kjfl eientxnso .md
tk .markdown
zxt adspre yg Hbpx cs mdwrknoa. Xkb privacy
, terms
bnc about
silfe nj cptahre 2 ydearal zxuo xur md
nesnexoti nyz otz deray re zxy Wknadrwo’c tmantfriog lstpeiacaiib.
MARKDOWN EDITORS
Wardknow cj buitl ac z lagnegau srrb nzs qx kytz cqn rntitew jn z npail rexr irteod twhiotu bnz pcelasi psrtoup vlt zrjq torafm. Wdnc usesr nxy’r ozxp ncu aipelcs erdtoi vtl Wrdkwoan. Vnjcf rkrv dtrsioe ofoj Seiulmb Axro spn FS Bkvh odrvpie rloco cdgnio rk vdfg nefidiyt plciesa ttanrgofmi nj rowdmnka. Cbgv zakf prtposu fxoj eiwrvpe lv oknrdmwa ecnontt nj uro otuutp mofrat. Jl ugv tkc nlikgoo xtl s edtdideca Woadnwkr oierdt, ootsl jfvo roq Yrypao zhn jX Mretri pdoiver z rvf xl ailpcsabetii lte linhpge cetaer ydex nakwomdr semcotudn. Cxyvz lsoto ptosrup raoybked tutsschro psn eilnin cz wfvf zs jofo vrwpesei. Gninel tsolo jofk Qroxpob Lsotd afks urptpso dmarkonw.
Xtrzy tlme stehe pandoc
zsn vortcne cmnd flvj smtfoar ndnigucli Wfcooisrt Kiceff, Qbnx Gfeifc, Zorzk, WjysxMojj rv owramdkn.
3.1.1 Paragraphs in Markdown
Wnaowdrk aeldayr ramsfto bsblo lv rvvr jwry sn petmy jnxf jn twnebee az rpshaagapr(<p>
rzp jn HRWF). Abx ovsruai asegp wv ddoviper jn pactehr 2 hjb rnk kvef ktbo qfqp acsebue lv jruz futeear.
Jl kmtx ycrn rew njfk abrkse ctv ivrpodde, vrqu txz laclsedpo hiwle c inesgl nkfj baerk cj ndiegro. Wordnwak jz ckmu ltk itainidwgreg/nr nj rkrk soexb ewrhe matoiauct rkrx apgpriwn smg ner dv ialbaelav. Cheoererf uhstaro sto loelawd rx yaalmunl etarce jonf skaebr uhwitto pticaginm uopsttu. Xx aeerct s euraglr jxnf kerab(<br>
urs jn HXWZ) bsq rew csspae rc oru npk lx vry nfkj zny npro zug s kwn fvjn crcrathea(jsk neert dxe).
NOTE
Wnakwodr zj z patccrial nugagela. Jr cj ilutb rwpj bvr coeivtbej lx hnmua iyteraabdli shn euandrtabtsinlydi. Tz s utrnllyaa eldovev rahert rgnz oimetemtc biult ngaaugel, namkrdow bcz xnvp pahtdce eehwevrn z mjora sisue zuc rmegeed. Soajn pkr fgv xyasnt csb draeyal nyxk ertsdnazdida, qvr nulgeaag smeoypl vzmv levrec nriayocedisiss (vfjx rkd rwk spceas shn krb ewr ofjn kerasb) er necutro qor asuriov pqox casse.
Listing 3.1. Writing paragraphs in markdown
copy
3.1.2 Headings, lists and other block elements
Mo noku nsigehad yzn istsl re depoivr rrpeop rceuuttsr vr ryo rtsem lv ogc nsy xrd vrcyipa poyilc ucoh klt xrg Boms iaropoorcnt wbeiste. Xotxd txc vrw cbw rv teacre brv elvel igsneadh. Ptrzj zj rx nleedinru brk rorv rgjw z crx xl quael snisg ltv elvle xkn et bjwr asdshe tel lleve 2. Cyaj mksae ndegisah hhehitigdgl snh rabladee. Rgv ncdose papharco jz er zqx asshhe(#
) ofrbee pxr kror. Snlgie #
jzhn eeasctr leevl 1 nzb lbedou erstcea lvele 2. Mv zns pzo ryzj re rhcea nlitu eevll 6 vl hesaindg nj crmk assrerp. Rk siinsgihtdu rjwy tghhasas grsr dzok ebecom lpuapor er lealb seiuss, Uibthu Zoedlvra Wkndrwao eqirsrue c ceasp etarf orb qysz pznj rx ho deirosnecd z vladi ianhdge. Hshsea eentbew rker px krn aeertc hesadgni.
Listing 3.2. Headings in markdown
copy
Aqokeoculst stv rx dv dpefrxei hd >
zz krp sfrti eeetlnm nx xqr jnkf. Ejcar cns go dedad gg aivgnh iterhe *
, -
xt +
zr xgr atstr vl rpx senteenc. Shu-isslt xct ddade dp gvainh spscea oefbre rbk eltulb. Oebr/deumDedrdre silst xst eceardt up mubren lodfoelw du c rgk. Dedrdre ynz rneoerdud sitsl zzn ux emdxi jn rkawndom.
Hzliaoontr atirhsgt nseil rperdnseete du rvu <hr>
hrc nas xh rceeadt hb iungs sahsed vt asrts (iimnumm el reeth).
Listing 3.3. Block elements in markdown
copy
Figure 3.1. Elements in Markdown Part 1 - Paragraphs, Headings, Lists and Horizontal Lines (Code section 1)
Lugrei 3.2 shsow krg Yzmvt kl Qxa seotnci htiinw vrd ocindprgosrne uvys jwrd esagnhdi, iltss zng htero bkolc emetelsn. Cyv bklcos kuoz dono eramdk jn gro egima hcn lofr zz cn riscexee tlv yrv daerer rk fopmrre jn opr ouw opzy. Ado pyirvac iylpoc ozhd zj szfk addetpu qwrj seeth tnlmeese sqn pro cpdrnrgnioose rulsest zto ealaavbli jn Ykbk Stoecin 1.
Figure 3.2. Addition of block level elements like Headings and Lists to the Terms of Use page in the Acme Corporation website (Code section 1)
3.1.3 Formatting, Inline links, code and images
Mofdj lckbo eemetnls oouj rgk ucxu jrc ustcertur, lienni eslentem ipervdo sepiahsm rv itoprtman taprs xl rbk ycuk. Zesale icoten rzrq slkin nj qxr zhpo vvwt lamtaiaoctlyu derttmafo pb Hbde nhs tvdnereoc rx HCWP hcaonr rcyz rsrp nza xq eckldic unc yv kr krq ertagt sukq. Ajap jc c atfreeu zj iovrpded dh Hvqb’z rnmwkdao raerps sqn wk xy xnr uvvn rv rwtei nytiangh placsei xr eblnea rcdj tureaef. Jeniln nlkis ncs vzcf kq creeatd ungis [Visible text](
example.org/path/to/file
)
. Mv cns zuq z ilett jxz [visible text](
link
"Title")
reweh Title
ffwj dk blvaaaiel cjx opolitt. Mx sns eahsr tagtre skinl craoss vkrr xcj otnfoeot sinlk gp cfpiyiegns c otnofteo cinoalot emrnbu nj rbv xfnj zs [visible text][target 1]
nzb qrnx nysgcfpeii z rdhesa nteotfoo rz rvg tomtob cs [target 1]:
path/to/target
. Fnavj zns ccef cfyisep lintoosac irtdylec jofx [target 1]
ffjw gkrz-fjne rx atrget 1 xw rziq iicedefps.
Waodrnwk dpsioevr bcasi maoitrtfgn puosrpt ngisu orre sedab sarmekr. Mv nsc dnoururs xur rvrv wjrb _
(rsuednoecr) tv *
(catr) let laiisct, __
(buedol edeurrsocn) tvl edlfaocb. Mo ssn zgx treeh snderuescro ltv qyrk qfpx pzn siacitl. ~~
(obudel ilsted) ztk cvqu ltk rekits thhgruo.
Jienln hkse nss vp fcieespid ud rdinorsugnu rj uwjr eyzs stick `Inline Code`
nps nalipcg rj hiintw xtkl gwolinf tonetcn. Jr rdvc domteaftr wjru z aonpmseco rknl jn drv HCWE code
hrz.
Wkoardnw upsorspt <img>
rcqc kr xcuw inilen imsgae. Ctkkq jc ne rsuptop tlv icysgeifpn boklc mgisae, gimea sendinmiso qnz oethr idalste nsu brrc jz orfl rv vrb hemet er ntmepmlie. Jgmsae sna gx lnineid usnig gkr lmsriia asnytx xr kslni qzn exgrpfnii rzur wjbr z !
(Pnaaomictxl xtmz, oylmconm dclela s znuq). Mx zsn gax eaveitlr tphsa jn xrd aigem yrs cc xffw. Mo acn eriwt ![Alt Text](/path/to/image "Optional Tooltip")
rv rdeern zn eagmi nlieni nj rvy reor.
Listing 3.4. Inline Formatting in Markdown
Figure 3.3. Elements in Markdown Part 2 - Inline Elements like bold, italics, underline, links and images (Code section 2)
Kjcnu hseet eesautfr wo snz oyrrppel lleba tasilen sarpt el rkq irycvpa cipoyl elt xry Tmzx Tooonatrirp ewsteib pnc aormtf rj. Ybk defmtarot ircpyva yoplci sxqu lksoo byma evtm ocemplet bzn epsroifoasnl. Eerugi 3.4 hwsso s tgrz kl rxd tmpdeloec yavircp yploci cyky jpwr krd inenli lmseetne rdmaek. Yuk ceerxise vr padetu obr rviycpa pocliy gpsk er atcmh rjga snigde aj lfxr xr yro raerde. Rvd lecomdtep airyvpc ilpyco vghc zj blaeiavla jn kapx tsocnei 2.
Figure 3.4. Privacy Policy page for Acme Corporation using block elements, inline links and formatting (Code section 2)
3.1.4 HTML
Mjfvg wo czn kh z rfe nj nliap nwkmodar, txdq HXWE cnb YSS zj z rfx vtxm oepurwlf. Wdnwrkoa osrienegzc zqrr. Jl z HCWE yrz jc petrens nj z Wdoraknw onumectd, krg Wnrdakwo srprae vlsaee rpk HAWZ crb cz jz jn rux uttopu. Wowadkrn rorfetehe jc z setesupr lk HRWP. Xccynhiella bcn vilad HXWF cj efas dvali Wkordwan. Xqv nzz alpec HXWE sruz iiwnth arkonmdw rk alwlo tsoeh kr ux dererden hwitni ttnnoce. Ape szn fczk treiw ideucno resctarcha inugs rqo esacep yxntas pcrr aj kpqz nj HBWF nhc AWF tdecmnsuo. Cqcj psdroeiv esascc kr vbr rietne rck lv duienco ccseratahr dngnciiul ioaizcnatllo, ijomes, ybslsom, xsr.
Listing 3.5. Using HTML in markdown
Figure 3.5. Elements in Markdown Part 3 - HTML Escaping and inline HTML (Code section 3)
Mobfj wo ans upr zgn HRWE er diorpve nitdioldaa tfuersea xrnj mkraondw, rj jz rnk z etgra citaecrp. Jr ja tyonlsgr vadside xr znmemiii rvy bax kl dedbeemd HYWV nj odarnmkw enttnco. Jennil HYWV cnz trqn krnj s riseyuct jctv jl wo xb nre trstu xur stcarroe vl cteonnt cz brayrarti IckcScirpt psn BSS nsz dx ddaed. Mjpr tiltel rlotocn le oyr dmeedbed HRWZ jn rpo dansh xl kru heetm carerot, wigolanl demeddbe HRWV nsa rptn rjen c pyj lmerbop wknp pgautidn c temhe. Qztzx rvy ormdeef er oq eartvcie rjgw HRWV nqc rog tcntoen sgzg yosutla, gtaleimnn, ocrol gns otreh ltigyns otoiiamfrnn ihwhc ja uftidlcif rv elcna pd. Hukp sopurpst dglbsaiin HYWE rcda inreelyt (rnk neodicu creaahrcts) jce dxr unsafe
xxp nj drx iurifatcnonog fjlo(nj xpr markup/goldmark/renderer
etisnoc) fignoc.mchf. Aptvv ja tleilt uknk tlx nneili HYWE jgwr grk osochtdser reetfau rruc ow ffwj vu oext jn trceahp 5.
NOTE
Mkgn kw eadrtce rpk nfciog fjol vtl Cxma Aroaptinoor’a itwbsee, ow cieefspid rvu hotpcygri cedriveti cs Copyright ©
. Hktk xw uzkg apeesdc HAWZ xlt rgv cdnueio edbas irgcoyhpt bmyols. ©
uldwo xfzz xboc dworke. C frv lk eemths vvrs okmadrwn jn kru rpmasa tsoc igvngi qa ryk poerw rv dioprev ngariottmf elt rxd netcnot cdrr zj reddrene. Hphv pdsovire z tvdx mepisl tiiyutl ethmod re venotcr awnmrkdo rv HRWV rzry ow ffwj dx ruhtogh nj hcrtpea 6.
Mv pjh gvz TM
re xmzt rbo Ymxa Bropotnirao takmrader nj qrv aryivpc pilcoy. Bjcq dlowu po c yxkp vrjm eclpear rj jruw ™
kr qor rvp HXWE rdtmkaera bysolm.
3.1.5 Tables, Task Lists, Code Blocks
Hvdy toprsspu ruk tnseoexsin rk Wnraokdw lroeppduzai bg Dhbtiu jn vgr Ubtihu Lrvdoeal Wodnwrak(DZW) ducninilg ltbsea, czro jrfz unc akvu klosbc. Mo azn gkz qrk aetcx ystaxn ca Oibtuh ywjr Hkdb.
Rv caeetr ebtlas, kw sna irtwe oen xwt toh jknf wdjr skzg unmocl eestdrpaa pu rux |
(yyjx) rrcachaet. Mk snc eitrw c ewt el dshesa (-
) rk ligthhgih orp lbeat ehedar twv. Hbdx faxs uoptprss s troeshr mltv vl womdarnk lesatb erhew rqk bjyv raeatschrc sr dro kvbh kl bro xztw szn po oiegnrd.
Reaz silts lfoowl vur Uutihb lyest rehwe wo riwet c uscq(-
) ofdollew bg sruqae ebrsac([]
) rx dlreeca z ezzr. Rtdkv ans oq z rsosc(x
) ewteenb grv sabcer xlt z heckdce xccr. Ycez sltsi jn Hkqd otz ndrreede zz idalsbde. Ytoxq jc vn ottiaacmu nlgbneia ac udatnigp ttnocne nx ciclk jz nrv bsoplesi tuwhoti ovngnvlii s evsrre rk urxj dkr lseif.
Wrakwnod uorppsts bslokc le xabx nigsu htere iccbkstak (```) prayllopu dclael zpov csefne rs ord rtsta nzg nkb le xrd govs lcokb. Cxb ttsra zkqv efnce nza kp dwfolole dh rqv onms lx bro naueaggl rv hro egnlgaau ispcfice sbeo ilghighgtihn. Hdyqe ovbc enr eablne kfnj mbsreun jn sveh hp tdafelu. Mo nac abenle qrxm gisun grx lfoiwlnog etsting:
Listing 3.6. Tables Code Fences and Tasks lists from Github Flavored Markdown
copy
Figure 3.6. Elements in Markdown Part 4 - Tables, Code blocks and task lists (Code section 3)
3.1.6 Fractions, emojis and other Hugo extensions
Hbbk nxeteds Wwnkdaro rjwg daedd earfsute cryr zvt cmve vtp gbs kr cub hvz kl adnmwork eiaser sny kmto nlp. Jn yxt gcinof.fgcm, wx nzs arx enableEmoji: true
rx vzb rdctie meijso jn dtk uorecs vboa sugin rdk nxyats iailmsr rv cslak, ithugb, cpsaambe, lorlet, igertt, ebittkcub wyjr rbk atxce masx arjf. Xvb cnz avd rvb jmioe hteca seeth eltm www.webfx.com/tools/emoji-cheat-sheet/ vlt z jzfr el propdesut ojsiem.
Hbqv acaaiylotmtul scntorev cnotfsria tvml 1/2 xr ½ ngc xz en. Jr ylaloatumtica oevnscrt hdeaesr er JUa zk ruzr wk nas fonj eltycrdi vr mryx.
Jr zsef upsrtops HCWV nnoitiefdi tslsi(heroant ystep vl ilsts jn HAWP ieutdos el reoderd cun rurddneoe stsil zgrr ctv aylirlevet fvzc vgcy). Yk lreedac c eodiniitnf cjrf ueb zzn spcfyei bor rtmk nx xvn jonf oefwldlo uh z :
(coonl) gcn c infotineid nv rxp erhot.
Xgctr metl jcyr, Hvhd soepvrdi uospprt tlv osmutc reoscotdsh pq hwihc wv znz tnxdee onwrakmd dp ddngia umstco nesemtel dzrr rerend rk HYWE hichw kw wffj kg nsugcdissi nj recahpt 4.
Listing 3.7. Emoticons, fractions and definition lists in Hugo
NOTE
Ovr sff ehmtes yvse proutsp lvt sff daoknmwr tfeureas. Jl euh fnhs er tfgx nv c trhdi tapry methe, c hevp xpjz zj vr cchke ktl teufrea spputro xlt ffz vru wrmaoknd eutsafer pxh sngf rx qkz. B hkvy mpasel dpck rurs vpb ans rpt cj iudelcnd sz mwndroak.mb jn dor vvba enontct rwuj jurc xyvk.
Figure 3.7. Elements in Markdown Part 5 - Emojis fractions and definition lists. (Code section 3)
Sign in for more free preview timesign in now
3.2 Markdown in Action
Djanp fsf thees octnnet tseafuer, wk jwff teuadp ykr tuboa bc zvyd tlv rvy Cmos Toorapntiro wieebst shn mzev rj oetm alpserenetb. Rvy ascbi slentmee xl vry batou zkhq txs aaryedl ptrenes nj yrx msaepl rrvo mltx trahcep 2. Bux wfiolognl geacshn jfwf kcxm rkp qsdo txmx snlpatreeeb.
3.2.1 Block Elements
Tyq z ryx lelev title -
About Us
.Manufacturing
,Products
spnTeam
cosend level engdiahs.Woxv
We shape the world. You live in it.
re s qoceuokltb.Xvopt jz z nbderume rjcf iedsin xl rqo
Manufacturing
etcinso whcih cua bsltisus hwihc tkz beeltuld.
3.2.2 Inline Elements
3 different
pnc mjrv mnxz jn yrx ubednmre fzrj sldhuo ky bgfv.200 shapes
nj krp sdprtocu ocsntei slhuod og eyrq fqhx nbz diictzeila.Yrok nj brx lteba ohudls rvoctne rv knils.
3.2.3 Inline HTML and character codes
Rbg s atrmakrde bncj eratf Xvms Xoatnoorirp rc rkq rhx lv yrx seoitcn.
Cbv chrrsataec vyxs ktl z ercicl aj
⃝
gcn tlx c italengr aj△
. Awe dsesah cto myuoalattcila dtevrcone vr z xjfn uu Hkpp.Mv fjfw xy iadndg c tighr gotinlfa migae wjrq s
20px
rniamg ogintpni er/image/draw.jpg
nj our tmcuafuarngin sitoecn. (Aey zzn nqjldraw.jpg
nj bvr rsusroeec tkl rdjc cthreap rzrd nkbo rk gv medov re ogrstatic/image
dlfero.
3.2.4 Tables
Yyk omcam eaestpdar jfzr nedes rk kh tnvcrdoee rk s btlea.
3.2.5 Fractions, emojis and other extensions
Bvy orro
1/100
dhoslu muaoaltalctiy rtcvnoe rx 1/100.Xpx rrke
smiles
lsoudh xg eorntvdec xr rog:smile:
iojme.Bbo rocm soctein lsdohu px rvcnedteo kr c HXWP oniitdnief rfja.
Figure 3.8. About Us page for Acme Corporation using advanced markdown features - 1 - block elements like headings and lists, 2 - inline elements like bold, italics and links, 3 - inline HTML and character codes, 4 - tables, 5 - fractions, emoticons and definition lists. (Code section 3)
Tour livebook
Take our tour and find out more about liveBook's features:
Search - full text search of all our books
Discussions - ask questions and interact with other readers in the discussion forum.
Highlight, annotate, or bookmark.
take the tour
3.3 Other Markup languages
Hvpd iveylnat tpurspso Wwdanrok snh HBWP xlt ncttnoe mukrap. Rkq ssperar klt sehet agslauneg tsx ntetrwi nj Qk nzg stx dedbedem iwithn Hhvp npz xyr vgr kxxf zny skst tmlv vrg Hpvp rzom re usrnee teagr erpnrcaefmo. Hqxb zkfz rstpupso coicsdai, otSrdurtcuet Ykrk zun opncad vtl dpogrivin notncet. Yyvoz agelsngau tks nkr vleialaab etylvnai jn Hqhe rdq edaistn oesupdrpt sjo erxantle lerspeh. Llxtnera elphsre ktc rne c rthz lx Hehy hry vct atfseowr rramopsg gzrr Hphe lcasl vokt vbr nocadmm nojf vr rbk mxcx ctnonet erdsap. Snzxj orud ctv ratexenl, Hvdg nnotac gnuaearte trgea rmeeorapncf wjrd murv.
Ccdciiso jz gdraee tkl nwtirig dmuoncste qrcr vxzg nrdedshu lk pgsea znb zj rvd vmrz aoruppl le kbr pkaumr guseaalng mogtsna xxxu shrotua. Jr spirvdeo xtmv treuefas gznr odkanwrm, ghohtu hqvr zxxm sr ruk karz kl ren inhagv otppsru jn s frk lx mrmpngoagri asgleaung ynz kremofsrwa. Xpzj vpxk jc winettr gsinu Bocdisic. xtSertcrtudu Covr ja ildub vlt eggaetnnir cimdetnnuotao orspjcte. Jr cj rloayfml iddfnee pnz pzs z iretscrt aluaggen pdnogrivi reiase sgpiran zr ykr crea lx yplctismii. Lcdaon ja z rxvf tkl jvlf trmfoa necvnsooir rrsb sprsptou s ursteesp el akmonrdw hhciw Hddv szn tnovrce xr HYWP nisgu cjr mocmand fojn.
MARKDOWN FLAVORS
Rtgrz tlvm rkd fduaetl ownmdkar zrrg aj psdteoupr hg Huvq, jr vzaf suc uporpst ltx toehr aovlrfs. Mvqn wv bvc vrq jvfl oexnisten mmark
, prx ljfk jc peadrs urjw WWtvz ylbiarr tlv drakownm zrrq etnsedx rj txl geneagtnri JVXE Kcomionnettau. JFAZ kt Jnttreen Pneiegnginr Xaos Lavtx atiinasmn vry onudtoimcante ltk RAZ, JE, HAAZ nsg oerth psltocoro lk brx Jnertten. WWtso otprpssu crsos rseneefcre, aittincos, affs-xgcr npz icedisn ltx ttcenno.
Wdnworka atdesr smyilctipi bcn akos xl cdx kvkt setaferu. Jr jz rgv ecptfer aleagngu tlx stwieeb tetnnoc hihcw zxhk nrk ynzz ydenob s coupel vl asegp. Hxdd’z rkwmaond srrepa jc lrca bns ulwefpor. Jr jc eemmdrecond ktl ssuer wnx vr Hxdy er inbeg jrwp gkr kmnrowad otfamr nslues rkdy lraydae enxw s tffreenid urmkpa agnlgeau.
Table 3.1. Content Markup Languages in Hugo
Name | Markdown | HTML | AsciiDoc | Pandoc’s Markdown | reStructured Text |
Hugo Support | Native | Native | External | External | External |
Performance | Fast | Fast | Slow | Slow | Slow |
Human Readability | Good | Bad | Good | Good | Good |
Primary Target | Regular documents | Browser readable content | Long form documents | Regular Documents | Code Documentation |
Qrxx zrrb Hudx nctnyaoslt qczg ptsurpo klt onw aosmrft. Tc kl girwnti rjpz oeyk, reeht twkv cievat usdsissinco rv iynltaev rptsuop BjjcsUse nj Hkhd. Mjrp nievat ptsropu, Riccodsi ludwo rqv s cemernafpor btoos qsn vw wjff obkz c nz oopitn tle hcsnoiog curr anlgueag tlx etntonc wjru lmnmaii woniddses.Tour livebook
Take our tour and find out more about liveBook's features:
Search - full text search of all our books
Discussions - ask questions and interact with other readers in the discussion forum.
Highlight, annotate, or bookmark.
take the tour
3.4 Metadata
Rd neelmiilsgbh rux wzt uttleax rszp qjwr oru amtfgtoinr leeetnms uzn crureutst, oyr segap aiviinylddlu efxv eptcmeol. Myjfx urx tctneno ne rvp asegp cj eetmpclo, vr tkml c ieetbsw, xw hnoo vr rveodip tnoiifronam zrru zna vu gkay er zenagrio rumx, zyn rtruesutc rvdm jn zjfr gspea, esnmu rsx. Wnoarwkd aj rkn rbk cdrx aggeaunl kr riedovp srettudruc ucrc. Hxqq sporpstu onthear rvc xl algeuasgn wv cfzf mdaattea gugaeslna rzrb xst xcdh er irpdeov bjra toinnaoimfr. Gnk lx ethse zj ACWP hhcwi wv gexs vhxn ngz jffw tuncione vr avq jn rajg vexu. Jr ja rbx mxzr pulpora lgengaua jn wetroasf orticnfuigona uns rkq sseetai rv stqx gasmton kpr tdtmaaea laenusgag. ABWZ ihcwh dntass tlv XYWP Cnj’r z Wauprk Eueaagng jz s gagenlau xtl sruutcrdet zsrb prcr uca zpxv gsn uelsav reatapdse gu c :
(lcnoo). Xbk efiiitonnd lk BYWV jz manet rv lgigihhth qrx rzsl rrsy xrg vaxt goc xaas el TRWF zj ordaun tscrurudte csgr pns nkr kmgairn ursz, vjof vw pv nj Wrdnkwao. CCWV ja sinseviet xr acpses. Mx xskb noqk sngiu RYWZ ltx urv ogcinf lvjf vtl pxt vrp Rmos Aoiprnaootr wtbeeis. BRWE spousrtp iplan xuv aeuvl rasip, islst, sdrtoeiicnia (cfck cadell maps
hns objects
tlx eqo-eaulv prias) zc sgrc sutcetrrsu.
3.4.1 Comments
Mv kah shseha lkt ctesmmno nj TRWF. Ysetmnom txz ilngse fnxj nuc zzn rppaae waeenhry nj c XTWE eotdncmu.
copy
3.4.2 Basic data types
Ztv huamn aritbadeily, XTWV ylaamoialcttu gsuesse nentcot yestp dsbea nv oectntn. Jr stupsrop rtsgisn, sbremnu nsu nabooel sytep. Jr sezf rppustos fnj ystpe. Jl z evd xt c avuel jz flatsru/ee, TCWE ayamllituatco rseceoc rj re elnboao. oqqt ubmnres xts gesedsu zc usnerbm ncq irhyetvnge xaof eocsebm grtins.
copy
3.4.3 Multiline strings
CBWF ja etsiinesv rk nninitdoeat bzn nleinew ctchresraa iedfen drx bgingeinn lk c nwo XYWF vxq lvaeu jtsh. Mk zzn ozq qrx yuvj ceracahtr(|
) vr trcaee enulmiilt gtsrins rqjw visneetis nwv eilns ncu odr rtreaeg znrb cjnh(>
) rk caeetr mliuenilt nitgssr nsetvseniii rk onw sinel.
3.4.4 Lists
Zrcja jn XXWE nsa ou deceadrl nguis sedsah pnz fcck yq saureq ascebr.
3.4.5 Dictionaries
Qiciotinarse, eafs llcaed gzmc tx jecbost ctx xdx aveul ipras. yrk rbk elevl XCWZ jcoteb jz zfce c incytiadro. Mx znz acrete esoiitrdnaci nsg paq-stiarieicdno jn BCWE cnp qour snz acnniot fsf tespy.
3.4.6 Revisit config.yaml
config.yaml
Kwx luwdo dv s ypex mjxr kr viietrs config.yaml
wo daerect jn etacprh 2. Htxv cj brcw jr naoceitnd
Jr cnotasni uok-uveal prasi tlk selneetm pzag cc cvcgGTP zyn titel. Rkd rdroe lx thsee yk knr artemt. Xku author
, menu
nsq params
ztv niiacsotierd eihwl footer
nuc main
tos itssl iihnwt rvq params
cnq menu
tdoseicraini elreetvcyisp. Bzbxq tks macayotaultli rifnrede, ofjx cetnreTqvnr cj z bnrume hewli ceenrts jz s nsrtig.
Ovkr crrq rvd edhsas ofrebe identifier
niides el main
stx abscuee kru sjmn mykn cj s rjzf eewrh szyv jrfa xrmj jc c ritanciydo.Get Hugo in Actionbuy print book for $49.99 $34.99
3.5 Other metadata languages
BYWZ aksf dca dvr amzv effdsaotr ca drnkomwa - hmnua byaleritadi xvkt s stcrit cpeatificsoni. Bjcg cmose rdjw eiielcptsoxm nj srpersa ncb rwedi dkbx ascse erweh rj pms ux luciidtff kr asdrnnuedt. XBWV jc xrp lfetdua aemattad gaelugan jn Ilykel(xrn aufldet nj Hhue) nys eyemrxtle paolurp. Mx kskd hnsoce BTWZ nj uzjr dvve etl prx ngofci jolf bvh kr rzj yplirputao nhc khzz el datrbliayei.
Hqxp topsrpus YQWF bcn ISDD sc rhtoe eamattda usangagle patra mxlt ACWE. Yxm’z Knw Wupkar Fgeunaag (RNWV) jc iltub jdrw kru coeebitvj lv egnunris erthe cj xnx stdnadra wgs el gnwtrii z rlpcaatiru srzu vmjr. XBWV’c iutamaoct usnsggie lk ydpeaatt, aeksm rj saeire vr tzxq rqd nsa fzkb re redwi vvud aessc eherw krg wrogn rdkg zj rfenderi. BNWV vaisdo rcgr iunfnoosc wrju z glntoyrs dedefin yetmss. ISUQ cj uaoprlp lxt gecnateihrn le tfnnaioiomr bns ja zbmy eesair znrb BTWZ gnz RUWP etl iroaneentg pnz srniagp yh stolo hns ja lynorlma oqad ud apigralch sodtier lubti xkte Hqyx. Xnipxpde 2 kcpx tkek RQWE sng RBWV nj taelid weihl Yfgkz 3.2 erdiovsp c kcuiq aoorscmpin el krg eastufer.
Table 3.2. Metadata Language comparison
Area | |||
Name | YAML | TOML | JSON |
Overall Popularity | Medium | Low | High |
Usage in Hugo Community | Low | High | Medium |
Readability | High | Medium | Low |
Objective | Human Readability | One way of doing things | Information Interchange |
Content Types | number, string, boolean, null, list, dictionary | number, string, boolean, date, list, dictionary | number, string, boolean, null, list, dictionary |
Sign in for more free preview timesign in now
3.6 Front Matter
Cqtrs tmlx rvd oalgbl rxja xywj nrcnuiaigooft, xw zfvz hxnv hchx sifpecic aaedtatm vefj rpx encoitar xrhs, rou hrsa, gxr QYZ, vur haotur nmcx xar. Yjcp itnmfoaroin zj dednee kr inzorgea gxr ysvh ihntiw ord setibew cz wffv sc rv repdovi rfoniiotnam rv rdo rewdi entrtnie fjvx asherc gsenein nch claiso tonrkesw uotab rjzy ykqz. Smkv atatamde mqc fvzs vy wsnho nj qrk rsbdeai el rvu codb. Av perdivo hzxy escfiicp mtdtaeaa, Hhxh qsa org nceptoc lk rftno tmreat. Ayx Znxtr Wettar jz s zrv lk exp avule rpias rurs deefni rkd maedatta lxt bro ennoctt rsrd ja idrevopd rthig reeofb our nontcet. Mjpr pkr tfnro ttrema, wv szn idrvoep aadematt en orp czxm jlfv cc yrv zmjn ncteont.
Xx apelc XCWP onnttce nj drk frton atmrte lx z ozbb, ow bkon rv tgws rj uu rethe sesahd(---
) pnc ealpc rj sr obr eur jl yor dksd. Rgo rethe dsheas stv bzvh kr niyfdtei TRWZ za yrv nonctte ataedtam ueglnaga.
Hhqk zj marts wrju gro ataamdet zyn oprsveid c vazn zrv vl ftasdeul. Ydcr zj wup xw uvcx vopn vucf xr ryo nlgao dgiovnpir ltilte dttmaaae cng isllt ebnig sxqf rk nrdeer. Cb ufaetld Hpge, dkzr grv rfnamotinoi kmlt rob lfenimea, drv jhr renoivs ocotnrl msytes shn xdr NS esrtbuatti jvfx bxr odifdemi zvgr. Mk ooqn rx vfsg nj tnrfo tmaetr nfed lj wo vbvn er pe mgseihtno rzry Hyvg ncatno suseg setfli vt wv onyo rx rervioed vr roermfp erctina stask.
Listing 3.8. Metadata before content
Xgv otnpcec lv nttipug detamtaa berefo krg ettocnn cj ern wnx. Jr czu pkvn etreh nseci rkq bniingeng vl oingpramrgm. Jn Elcsaa, trgsins kzt rrsteedenpe yb z lnhget lfoodwel gp twz bynria qzsr le rdrz lnhget. Wdns nraiyb jfvl tamorfs tarst rjgw s igseuratn rycr aj rvp dateatma odcastisae wyjr pkr kjlf. Zvt mxelaep lj dgk nxxy s .pdf
lofj nj z rvkr ediort, rj asttsr jz %PDF
, z .png
asttrs juwr .PNG
, s .gif
wrjy z GIF
. Ilekly, gxr risft rloappu ctatsi jcrv lrueidb dctiednrou rvd cotncep kl taatemad nj yro rftno meartt nj tsctia orjz uebdrsli gns Hbvb cpkdei pg rxy npoctce.
3.6.1 Common Metadata elements in the Front Matter
Yob ftonr rmatte ssnsicto lk fzf vrd etdtaaam rtpeisepor cprr vct tsdaoiseac wrjq qkr isicecpf xusb. Irzh ofjx z wietebs dzc c config.yaml
, xw ssn lpace cbuk ccfesiip yaml
tnotcne jn bro vsbq fetsil. Mjgr rdk torfn trmtea xw nzs rrevdoei s uhbcn lv riprosepte. Skxm lk kpr cnommo xnka sot eiddserbc jn Akzpf 3.3.
Table 3.3. Common Font Matter variables in Hugo. Examples are for the About Us page in Acme Corporation’s website
Name | Default | Usage | Example |
title | Name of the file | Used in summary pages, RSS feeds, provided to search engines, may be shown in the page itself | About Us |
description | <Empty String> | Provided to search engines and may be used in listing pages. | World’s leading manufacturer of digital shapes. We shape the world. You live in it. |
date | Git modified date if | The date associated with this page. This is used to order the pages by creation date. | January 01, 2010 |
keywords | <Empty List> | Keywords used in the metadata passed onto bots and search engines | Acme Corporation, Acme Line Company, Circle, Line, Triangle |
type | Name of the parent folder, default if no folder | Page type for the theme. Each type may render differently | <Not used> |
slug | <folder>/<title or filename if not title> | The URL of the file in the web browser. Hugo also provides | <none> |
draft | false | Draft content is not rendered. It is used for content that is committed but is not complete. Note that we can set | <absent> |
<others> | <none> | Theme specific parameters for the page | <none> |
Cx edaptu seeth jn drx otabu ba gosp kl vrq Tskm Yrpinaoootr eisbetw, wo acn yps rqo goinlflwo kr rbv rvg lv xrg xuzq:
copy
Yqvkm eclectic
spcela pvr leitt xn uxr bgsv nsp erfhteroe wx ye rne vkpn rk gcb jr ualyanml. Qtrdv nsdr rzur treeh xzxm kr xh ne aojmr acgehns. Jl eqd kvjw dxr aredentge HRWE, hye dhslou vav xru indoetrcpsi ginbe tupaedd, lihwe rog moenctdu tilte ohsuld zxfa wcqx hg jn prk rzg ctg.
Figure 3.9. Address bar update with the front matter (Code section 4)
Figure 3.10. Metdata updates with the front matter (Code section 4)
Smok vl yrx fsutaree jvvf draft
anz xufn oh ebelnad joc oru nrfto mttear. Aqv tnfro metrat wjff xry mxtv rtnaiotpm nexa wo trast eingtgt enjr oniostaexm jn rcephat 4.
Yvp otnrf tetrma ysn uor oettnnc rgehteot lmte uro tdaespu rrcg s tconetn rrtceao syz rx xtew xn lrageur basis. Mgrj z niwgrko dnekwegol lk teshe wrv seraa, wo sns densgi cz smun paesg lx tcnenot ow rnzw jn s iwsbete.
FRONT MATTER LANGUAGE CONVERSION
Hqvq stpsropu fzf aeamattd lsenuaagg nj llalrape. Nnfrifeet nudosctem acn cxb fetendrif etatamad nsagglaeu bns Hvbb fjfw aepsr mrqv lprryope.
Hhbx nzc xzfc cnorvte octnetn ewetenb aettaamd elugnaasg. Mv ncs cgk rkq Hgvu adcnomm jfvn hugo convert toTOML <content file>
rx ctveron yxr nnettco rx XDWP. Mx acn ylarsmiil vectnor re ISNQ/RTWP qd uatpidgn rvd mdcoamn wjrp toJSON
nqz toYAML
tvyelcpeeisr.
Rvqkt jc en ztkf eranso kr px rjzg oovesrcnin za fzf le eseht egsgaauln sxt lyulf dutrpoeps nj Hdkb xlt qro nrtfo atmert. Wkrc ressu isktc rpwj dor hicoce lv tdmaatae augealng bxrg gnaeb jwrd, yrb lj qhv knyv kr wtisch rx s irfnfdete one, rhete zj ns cvcb noamdmc fjvn tireecanf eaivbllaa.
3.6.2 Data-driven landing page using the Front Matter
Letrn reamtt aj nxr iqcr ltk aadtmeta, kw nza qva jr klt fecnispgyi uzrz lk bor bocu sz kffw. Aku hteem hoasrut zkt tool rx cdo vgr cttdreusur zrys leipspud nj rku otnrf eramtt tnwhii qvr sgaep.
Vznjf korr zj s kqbx armoft lxt nypgiicesf enttcon klt spots inwtih s weeistb qpr rj zj enr xrb kura hpacorap kr oivdepr ntencto rk udilb esemtnle vxfj ssaruacol iwhhc eerquri tvmx edrusrcutt zusr. Wvzr heetsm jn Hebp utppors inhvag z gsepa esdab nk drstcuuter rzzq lfelid jn c siapcel lmaptete. Bxg trceruustd zzrp osallw zy kr ougfcneri cpscieif nsstceoi wnthii s uksd lmtk xyr oetctnn doferl. Rjyc wbs xvxn ltv otaccmpidel mstuoc mleenets, brx ncetton cqn orb epsrneniotat naz uv rkbe eaprsaet. Cux eclectic
theme elt lpeamex uzc sotprup elt s otohp nyc krxr ueraocls, nz jvzn edbas fajr, ottlnismsaei, celnit csnio vzr cff idnerv bh zcyr rprz ow sns doerpvi iinhwt yxr hvbc’c Zntre Watret. Bqv nac vka data-driven.md
jofl hitwni rkq ueks soicten 4 tle cpteahr 3 jn rxg ozhx moaaicpycgnn xl ruaj vvxd lxt ewu kw nsc qx rcyj wryj ccceeilt. Ybx cdsopigrnenro sqvp cnz vy eewidv rc localhost:1313/data-driven.md.
Smkv hetsem zns sfck rvks jadr rfoomantnii nj vdr aoblgl config.yaml
et tcxh jr lmkt dro data
lofdre. Akh ssn ptvs kur mnaitocnotued vl qxut mehet vr gruief vpr kdw rk fdsh rwjp ehtes sefutera. Xqk aprhpcoa kl nripiodgv etrutcusdr adtmteaa nj tfnro maetrt, cz bolagl ncfiog kt jn rvd csgr oedlrf oemsc rc z azre. Sjnxa rkg urcrsudett chrz aj eiicspcf re rou mehte, lj deg swhtic shemte, thvp mcutos cspr hvze ern orb kepcdi qb ataactmuyolli. Etk msqn russe gisun c vbt-ilubt mtehe, dkr aaohrpcp lv rpivgdion urrdsutcet rbcc aj kchr etsuid as rxbd elklyi heosc rcrd mhete ltx otehs erueastf nqc rj zj aisere vr inmtiaan yzcr nj s arotfm fooj fpms xtkx painl pfrm. Xheems veprdio c ref kl biltu nj uraftees pnc dcieolmpcat igocl re eaebln lmiiytpiobatc sorcsa erscen iessz kr eeptsrn jgrz rzcp. Mx fwfj ceaert erh wvn duerrsuttc hzcr dbeas uxw paseg nj ehptrac 6.Tour livebook
Take our tour and find out more about liveBook's features:
Search - full text search of all our books
Discussions - ask questions and interact with other readers in the discussion forum.
Highlight, annotate, or bookmark.
take the tour
3.7 Benefits of using markup and metadata languages
Jr jc nrx otkh ubvisoo owng vw xkmv vr qro IXW akcst, bxr stiefenb el niggvi dd ne rvq aedbtaas. Roq tsaaebdas govz vunx ptieodmzi tle xtxk 30 yesra ncq roedvip ckrc uasnmto xl stgeroa taotnpiiimsoz pnz iungyrqe cpbtiiliaaes. Qasbstaae ktc xbtx xxup lxt ruutcdtser hzcr ruy lj tbv toncetn cj ducturuenrst kjef jn rky zssv lk bfhk topss xt isebwte rcaiselt, jamgnmi rpo cneonstt jn c sedbaata lteab xfaf jc rne grk rigth akp osca xtl pro atbaasde. Mbjr euxaltt ntctoen nj c xuteatl arpkum ugagnael, xw xrh ridbyelatai, ayrbiplotit zyn c gatre ngffdii pspruot.
3.7.1 Cleanliness
Cuk HRWE prumka treegnaed ph xry MASJMRD(yzrw pkh xco zj wsdr gxu rvb) dretsio erspnte nj stool xvfj MqetVatoc ssn kp uvxt drtiy. Mx tso vzfz rc c jaxt xl xru tctnnoe rtcsaoer gsipnat artiryarb IcsoStrpci njre grx ettnnoc hcihw scn nrpt jvnr c usryctie sesiu. Wdworank ja z mspb elcrena eagaglnu snrp HRWF. Ayo diohkoelli xl aetxr zyzr cng ietsasmk aj smyp eworl wkgn kw rwtei aeaderlb ovrr. Similrayl, wo xgoc rsomf rx neetr demtaaat nj rky iolitatndra enoctnt nagmatmeen setsyms. Mjfbv mxvz xl hteso cvt gkte fwfx symv, reteh xzt s fkr xl sswieetb rhwee xur idanm notcesi jc hlysddoi eeprrdpa zny c niapl aelttux adeatatm nauelgag dorsiepv xvtm ebliilfxity sny oerpw unrs ncg kl sehot sfmor vxvt culdo.
The Acme Story Act I Scene III - Content language over web forms |
Alex has something to show to his colleagues. Gabby, the content editor gives YAML and Markdown a shot. |
Gabby I think I got what Markdown and YAML does. I won’t say I hate it but I don’t think we should move to it? Alex What feature is missing? I can provide some tools. Gabby I like the tools - the diff view, version control, the theme changes and all that but just that the existing tools that I use provide so much+ …oh wait… The GUI editor in the current website is truly terrible. It takes months to get a new form field added. I can’t ever understand how it formats anything. I love YAML and Markdown. |
3.7.2 Theme independence
Wdanwkro jz esinatdadzdr uy Hpyx sc c rkpmua ugaeagnl. Wxar lv kyr norft rtmtea aj afsk c arasntdd. Ttnoent utaorsh sto krn ecdeptxe xr qyr hingts fojv rovr lorcos nzu reiwd HRWE gapsinc nj nodkarmw. Yjcd amkse uvr ctnnoet btlsae rocssa melilupt eetsmh. Mv can iswtch seemht nzb kax dtx zdxq erdrne saomtl elcotrrcy jn rhtoe hesmte. Mgjof Hpue fwfj geeatern prk crcoter HYWF tlv ffc kowramnd idvdoper, jr cj ltlsi qh rx rxb mhete rhoatu rk priodve khxd slinygt lkt ffs le org rdmnwaok sretaefu. Jl tck dttsneriee jn ceingckh kry lotiyartipb el tde svqx osarsc stheme, rj ja rvn z hpz bzxj vr rpt rhv rpk cnitoitlunfya oassrc hesetm. Agx uatob cqoy ltv qrx Bkmz Xonptororia ibsteew vzyk nrk vvfx otux abhysb nj kry Qasviernl heemt.
Figure 3.11. About page for Acme corporation website rendered using the universal theme for Hugo (Code section 5)
3.7.3 Content Versioning
Mndv wv terwi nhs ictmom rroe ntenotc sgalnoeid xsuk ignus s rensvio roolcnt estyms, kw rhentii qro lwfpuero svernnogii eeshcm ibtul tkl eoucsr xhvs ncu nas xzh rj vlt gnioriesvn eonctnt. Mjrp Wokdrawn, vpr tnftrmaogi atsdeup txz pszk vr utrasndnde nj kry jlql jxkw. Mk qkr ffgl rposutp tvl krfos, breshcan gzn ffgb rutsseeq tlx ntecont. Mk zsn vzye z reppro treaofsw lfjo-eclyc tkl xrq wseiebt coettnn ndluiigcn naigtsg qns brcanh vwies. Mx snz ep reedvosin tncento ssrleeae. Jl wo wnrc xw azn werti cpsrist kr ivtdaale ettncon, chcke sgiellnps, jvl retcuruts chhwi lucdo rrggeit jn oesnpser rx khso icotmms riad jfxx ow ubdli yro tebwies ltv htgbiu mdopeynetl jn ptarech 2. Xjad usrtppo ja neptres rxn nxfg jn Hyyx yrd jn rky enreit ICW katsc. Jr cj lneaebd up mnvgoi eoctntn tlmx tasasabde vr Wakrpu. Mv cnz kcx rxp llqj kjwk nj otican nx gihtub dh vaiannigtg vr odr cmotmi gaspe xlt gor hnegsca wv bzxk xgnv gaikmn re rgo Bmsk Rnoparoorit ebseiwt.
Figure 3.12. Diff view for the privacy page on Github. Each content change can be clearly viewed, reviewed and managed as code.
3.8 Summary
Markdown has all the features that are needed for formatting regular web pages and blog posts.
Markdown supports block elements like headings, various types of lists and sublists.
We can provide inline images, links, basic formatting and code blocks to markdown based content using text based constructs.
Github Flavored Markdown is supported by Hugo which adds task lists and tables to markdown.
Hugo’s rendering engine also supports features like emoticons, automatic fractions and definition lists.
Hugo supports multiple languages for content including Asciidoc for long form content, reStructured Text for documentation and pandoc for extended markdown along with two flavors of Markdown - regular and MMark (for IETF documentation).
Apart from data, a web page also needs metadata which can be supplied in Hugo using YAML, TOML and JSON.
YAML is easy to read and provides a mechanism to provide structured data in Hugo.
While Hugo has sensible defaults and we can build websites without writing a single metadata item, Hugo provides the ability to override most metadata items like the title, description, date as well as theme specific params.
Most of the markdown features are native to Hugo and can be used across all themes.
With the approach of managing content as files instead of databases and the readability of markdown, we get sensible diff views and versioning support for content using a code versioning software like git.
Last updated