theme: cache output-suffix #380

This commit is contained in:
Sören Weber 2022-11-12 23:39:48 +01:00
parent a425a0680c
commit dbb37a29a8
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -1,14 +1,14 @@
{{- $base := .base }}
{{- $page := .page }}
{{- $parameter := .parameter }}
{{- $format := partial "output-format.hugo" $page }}
{{- $suffix := partial "output-suffix.hugo" $page }}
{{- $f := printf "/layouts/partials/%s.%s.%s" $base $format $suffix }}
{{- if or (not $format) (not (partialCached "fileExists.hugo" $f $f)) }}
{{- $outputFormat := partial "output-format.hugo" $page }}
{{- $suffix := partialCached "output-suffix.hugo" $page $page $outputFormat }}
{{- $f := printf "/layouts/partials/%s.%s.%s" $base $outputFormat $suffix }}
{{- if or (not $outputFormat) (not (partialCached "fileExists.hugo" $f $f)) }}
{{- $f = printf "/layouts/partials/%s.%s" $base $suffix }}
{{- if partialCached "fileExists.hugo" $f $f }}
{{- partial (printf "%s.%s" $base $suffix) $parameter }}
{{- end }}
{{- else }}
{{- partial (printf "%s.%s.%s" $base $format $suffix) $parameter }}
{{- partial (printf "%s.%s.%s" $base $outputFormat $suffix) $parameter }}
{{- end }}