Improve handling of templates, fix issue with Hugo 0.5.0

Removes wrapping the template maps in an extra slice
This commit is contained in:
dzello 2018-11-08 23:50:21 +00:00
parent 778a6153a9
commit cc282afdb7

View file

@ -16,12 +16,19 @@
{{- $noOutput := slice "content" "template" -}}
{{- $template := $params.Get "template" -}}
{{- if $template -}}
{{- $scratch.Add "templateParams" (slice $.Site.Params.reveal_hugo.templates) -}}
{{- $scratch.Add "templateParams" slice -}}
{{- with $.Site.Params.reveal_hugo.templates -}}
{{- $scratch.Add "templateParams" . -}}
{{- end -}}
{{- if ne $.Page.File.LogicalName "_index.md" -}}
{{- $scratch.Add "templateParams" (slice ($.Site.GetPage $.Page.Section).Params.reveal_hugo.templates) -}}
{{- $scratch.Add "templateParams" ($.Site.GetPage $.Page.Section).Params.reveal_hugo.templates -}}
{{- end -}}
{{- with $.Page.Params.reveal_hugo.templates -}}
{{- $scratch.Add "templateParams" . -}}
{{- end -}}
{{- $scratch.Add "templateParams" (slice $.Page.Params.reveal_hugo.templates) -}}
{{- range ($scratch.Get "templateParams") -}}
{{- $templateParams := $scratch.Get "templateParams" }}
{{- range $templateParams -}}
{{- if (ne . nil) -}}
{{- range $key, $value := (index . $template) -}}
{{- $scratch.SetInMap "template" $key $value | safeHTMLAttr -}}