hugo-theme-relearn/layouts/partials/output-partial.hugo

17 lines
744 B
Text
Raw Normal View History

{{- $base := .base }}
{{- $page := .page }}
{{- $parameter := .parameter }}
{{- $outputFormat := .outputFormat }}
{{- if not $outputFormat }}
{{- $outputFormat = partial "output-format.hugo" $page }}
{{- end }}
{{- $suffix := partialCached "output-suffix.hugo" $page $page.RelPermalink $outputFormat }}
2022-11-12 22:39:48 +00:00
{{- $f := printf "/layouts/partials/%s.%s.%s" $base $outputFormat $suffix }}
{{- if or (not $outputFormat) (not (partialCached "fileExists.hugo" $f $f)) }}
2022-11-12 14:16:53 +00:00
{{- $f = printf "/layouts/partials/%s.%s" $base $suffix }}
{{- if partialCached "fileExists.hugo" $f $f }}
{{- partial (printf "%s.%s" $base $suffix) $parameter }}
{{- end }}
{{- else }}
2022-11-12 22:39:48 +00:00
{{- partial (printf "%s.%s.%s" $base $outputFormat $suffix) $parameter }}
{{- end }}