{{- $path := $.link -}} {{- $ls := readDir (print "content/" $path) -}} {{- $dirs := where $ls "IsDir" true -}} {{- $files := slice -}} {{- range (where $ls "IsDir" false) }} {{- $file := strings.TrimSuffix ".md" .Name -}} {{- $fpath := print $path .Name -}} {{- $link := strings.TrimSuffix ".md" $fpath -}} {{- with $.context.Site.GetPage "filepath" $fpath -}} {{$files = $files | append (dict "name" .Name "title" .Title "sort_title" (print "sort_" .Title) "weight" (cond (eq .Weight 0) nil .Weight) "file" $file "fpath" $fpath "link" $link) }} {{- else -}} {{- end -}} {{- end -}}