{{- $renderPaths := slice -}} {{- $collectDict := dict -}} {{- range $printItem := .Params.print -}} {{- if $printItem.from -}}{{- $pagePaths := slice -}} {{- with site.GetPage $printItem.from -}} {{- $from := .Path -}} {{- $renderPaths = ($renderPaths | append $from) | uniq -}} {{- $pagePaths = slice $from -}} {{- with $printItem.follow -}} {{- $currentSet := slice $from -}} {{- range $hop := . -}} {{- $nextSet := slice -}} {{- range $pagePath := $currentSet -}} {{- with site.GetPage $pagePath -}} {{- $nextSet = ($nextSet | append $pagePath) | uniq -}} {{- $children := partial "GetPagePathsFromParam.html" (dict "page" . "param" $hop) -}} {{- range $child := $children -}} {{- $nextSet = ($nextSet | append $child) | uniq -}} {{- end -}} {{- end -}} {{- end -}} {{- $currentSet = $nextSet -}} {{- end -}} {{- $pagePaths = $currentSet -}} {{- $renderPaths = ($renderPaths | append $pagePaths) | uniq -}} {{- end -}} {{- with $printItem.collect -}} {{- range $name, $param := . -}} {{- $collected := index $collectDict $name | default slice -}} {{- range $pagePath := $pagePaths -}} {{- with site.GetPage $pagePath -}} {{- $paths := partial "GetPagePathsFromParam.html" (dict "page" . "param" $param) -}} {{- range $p := $paths -}} {{- $collected = ($collected | append $p) | uniq -}} {{- end -}} {{- end -}} {{- end -}} {{- $collectDict = merge $collectDict (dict $name $collected) -}} {{- end -}} {{- end -}} {{- else -}} {{- warnf "print: page not found: %s" $printItem.from -}} {{- end -}} {{- else if $printItem.emit -}}{{- $pages := index $collectDict $printItem.emit -}} {{- with $pages -}} {{- $renderPaths = ($renderPaths | append .) | uniq -}} {{- else -}} {{- warnf "print: emit key not found: %s" $printItem.emit -}} {{- end -}} {{- end -}} {{- end -}} {{- return $renderPaths -}}