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