mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 14:14:48 +00:00
24 lines
894 B
HTML
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 }}
|