Syllabus/themes/sandpoints/layouts/_default/single.html

53 lines
1.7 KiB
HTML

{{- define "singlebody" -}}
{{ $currentNode := . }}
{{ $currentDir := "" }}
{{ with .File }}
{{ $currentDir = .Dir }}
{{ end }}
{{ range $k, $v := $.Site.Data.sandpointsnamegraph }}
{{ if eq (substr $currentDir 0 -1) $k }}
{{ $.Scratch.Set "plural" (index $v "plural") }}
{{ $.Scratch.Set "depth" (index $v "depth") }}
{{ if eq (index $v "depth") "core" }}
{{ $.Scratch.Add "core" $k }}
{{ $.Scratch.Add "mantle" (index $v "has" 0) }}
{{ $.Scratch.Add "crust" (index (index $currentNode.Site.Data.sandpointsnamegraph ($.Scratch.Get "mantle")) "has" 0) }}
{{ end }}
{{ if eq (index $v "depth") "mantle" }}
{{ $.Scratch.Add "core" (index $v "in" 0) }}
{{ $.Scratch.Add "mantle" $k }}
{{ $.Scratch.Add "crust" (index $v "has" 0) }}
{{ end }}
{{ if eq (index $v "depth") "crust" }}
{{ $.Scratch.Add "core" (index (index $currentNode.Site.Data.sandpointsnamegraph (index $v "in" 0)) "in" 0) }}
{{ $.Scratch.Add "mantle" (index $v "in" 0) }}
{{ $.Scratch.Add "crust" $k }}
{{ $.Scratch.Add "mantle_has" (index (index $currentNode.Site.Data.sandpointsnamegraph (index $v "in" 0)) "has" 1) }}
{{ end }}
{{ with index $v "in" }}
{{ $.Scratch.Set "in" (index $v "in") }}
{{ end }}
{{ with index $v "has" }}
{{ $.Scratch.Set "has" (index $v "has") }}
{{ end }}
{{ end }}
{{ end }}
{{ $depth := $.Scratch.Get "depth" }}
{{- partialCached "header.html" . $depth .RelPermalink hugo.Environment -}}
<h1>{{ .Title }}</h1>
{{- partialCached "singlebody.html" . $depth .RelPermalink hugo.Environment -}}
<div class="content">{{ .Content }}</div>
{{- end -}}