{{- $base := .base }} {{- $page := .page }} {{- $parameter := .parameter }} {{- if or (not ($page.Scratch.Get "relearnOutputFormat")) (not (fileExists (printf "/layouts/partials/%s.%s.html" $base (($page.Scratch.Get "relearnOutputFormat") | lower)))) }} {{- if (fileExists (printf "/layouts/partials/%s.html" $base)) }} {{- partial (printf "%s.html" $base) $parameter }} {{- end }} {{- else }} {{- partial (printf "%s.%s.html" $base ((.page.Scratch.Get "relearnOutputFormat") | lower)) $parameter }} {{- end }}