{{ define "main" }} {{ $landingData := .Site.Data.landing }} {{ $map := newScratch }} {{ range $key, $value := $landingData }} {{ $sectionTitle := (index $key) }} {{ $weight := string ($value.weight) }} {{ $template := string (replaceRE `( |-{1,})` "_" $value.template) }} {{ with and $template $weight }} {{ $map.SetInMap "wgtTpl" $sectionTitle (dict "weight" $weight "template" $template "sectionTitle" $sectionTitle )}} {{ end }} {{ end }} {{ range sort ($map.Get "wgtTpl") ".weight" }} {{ $.Scratch.Set "sectionTitle" .sectionTitle }} {{ $path := printf "landing/%s.html" .template }} {{ partial $path $.Page }} {{ end }} {{/* printf "%s" (sort ($map.Get "wgtTpl") ".weight" ) */}} {{ end }}