authors/editors and dots in toc..

master
Marcell Mars 3 years ago
parent b3db1a987f
commit 5d684c2faf

@ -17,34 +17,33 @@
{{ end }}
</div>
<div class="rightcolumn">
{{- range $k, $v := .Page.Params.editors -}}
{{- with $.GetPage (printf "/editor/%s" $v) -}}
{{- with not $k -}}
<div class="has hasauthors">
<div class="hassup">editor{{ with $.Page.Params.editors }}{{ if gt (len .) 1 }}s{{ end }}{{ end }}</div>
<div class="afterhas">
{{- end -}}
<div class="crust">
<a href="#{{ .File.LogicalName }}">{{ .Title }}</a>
</div>
{{- end -}}
{{- end -}}
{{- with .Page.Params.editors -}}</div></div>{{- end -}}
{{- range $k, $v := .Page.Params.authors -}}
{{- with $.GetPage (printf "/author/%s" $v) -}}
{{- with not $k -}}
{{ $closeDivs := false }}
{{ $sandnamePlural := (slice) }}
{{ range $k, $v := $.Site.Data.sandpointsnamegraph }}
{{ $sandnamePlural = $sandnamePlural | append $v }}
{{ end }}
{{ $paramsKeys := (slice) }}
{{ range $k, $v := $currentNode.Params }}
{{ $paramsKeys = $paramsKeys | append $k }}
{{ end }}
{{ $mentions := intersect $paramsKeys $sandnamePlural }}
{{ range $mention := $mentions }}
{{ range $k, $m := index $currentNode.Params $mention }}
{{ $mentionLink := printf "/%s/%s" (substr $mention 0 -1) $m }}
{{- with $.GetPage $mentionLink -}}
{{ with not $k }}
{{ $closeDivs = true }}
<div class="has hasauthors">
<div class="hassup">author{{ with $.Page.Params.authors }}{{ if gt (len .) 1 }}s{{ end }}{{ end }}</div>
<div class="hassup">{{ with (index $currentNode.Params $mention) }}{{ if gt (len (index $currentNode.Params $mention)) 1 }}{{ $mention }}{{ else }}{{ substr $mention 0 -1 }}{{ end }}{{ end }}</div>
<div class="afterhas">
{{- end -}}
<div class="crust">
<a href="#{{ .File.LogicalName }}">{{ .Title }}</a>
</div>
{{- end -}}
{{- end -}}
{{- with .Page.Params.authors -}}</div></div>{{- end -}}
{{ end }}
<div class="crust">
<a href="#{{ .File.LogicalName }}">{{ .Title }}</a>
</div>
{{ end }}
{{ end }}
{{ end }}
{{- with $closeDivs -}}</div></div>{{ end }}
{{ if and (not (eq $scratch.depth "crust")) $scratch.has_children }}
<div class="has hashas">
@ -53,8 +52,17 @@
{{ end }}
<div class="afterhas">
{{ range $scratch.has_children }}
<div class="{{ $scratch.child_depth }}">
<a class="toc" href="#{{ .File.LogicalName }}">{{ .Title }}</a>
{{ $authors := "" }}
{{ range $k, $authorLink := .Params.authors }}
{{ $authorPage := $.GetPage (printf "/author/%s" $authorLink) }}
{{ $prefix := ", " }}
{{ with not $k }}
{{ $prefix = "" }}
{{ end }}
{{ $authors = printf "%s%s" $prefix $authorPage.Title }}
{{ end }}
<div class="{{ $scratch.child_depth }} crustoc">
<a class="toc" href="#{{ .File.LogicalName }}"><span><span class="back">{{ .Title }} ({{ $authors }})</span></span></a>
</div>
{{ end }}
</div></div>

@ -10,10 +10,7 @@
{{ $sandnamePlural := (slice) }}
{{ with (index $currentNode.Params "authors") }}
{{ len (index $currentNode.Params "authors") }}
{{ end }}
div class="{{ $scratch.depth | default "crust" }}title"><span class="supt">{{ substr $currentDir 0 -1 }}{{ substr .Title 0 1 }}</span>{{ substr .Title 1 }}</div></div>
<div class="{{ $scratch.depth | default "crust" }}title"><span class="supt">{{ substr $currentDir 0 -1 }}{{ substr .Title 0 1 }}</span>{{ substr .Title 1 }}</div></div>
<div class="grid">
<div class="leftcolumn">

Loading…
Cancel
Save