Files
2026-01-02 22:07:38 +00:00

24 lines
894 B
HTML

{{/* Hugo Blox Kit content preview renderer */}}
{{ $page := .page }}
{{ $item := .item }}
{{ $view := lower .view | default "card" }}
{{ $fragment := .fragment | default "body" }}
{{ $view_dtype := printf "%T" $view }}
{{ $index := .index }}
{{ $html := "" }}
{{ if not (templates.Exists (printf "_partials/views/%s.html" $view)) }}
{{/* Fallback to card view */}}
{{ warnf "Failed to locate view at `_partials/views/%s.html`. Check you specified a supported `view` in `%s`" $view $page.File.Path }}
{{ $view = "card" }}
{{ end }}
{{ if eq $fragment "body" }}
{{ $html = (partial (printf "views/%s" $view) (dict "page" $page "item" $item "index" $index "config" (.config | default dict))) }}
{{ else }}
{{ $html = (partial (printf "views/%s--%s" $view $fragment) (dict "page" $page "item" $item "index" $index "config" (.config | default dict))) }}
{{ end }}
{{ return $html }}