From 848a7c6a2adf34ef9f58f5104005a110db2814d3 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Wed, 28 Sep 2022 23:19:28 +0100 Subject: [PATCH] feat: add support for View wrappers E.g. a custom view (views/custom.html) can be wrapped with: views/custom-start.html views/custom-end.html This allows for custom grid-based views (cards, etc.) --- modules/wowchemy/layouts/_default/list.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/wowchemy/layouts/_default/list.html b/modules/wowchemy/layouts/_default/list.html index ea7ee996..231fbdaf 100644 --- a/modules/wowchemy/layouts/_default/list.html +++ b/modules/wowchemy/layouts/_default/list.html @@ -7,11 +7,20 @@
{{ . }}
{{ end }} + + {{ if templates.Exists (printf "partials/views/%s-start.html" (lower $.Params.view | default "compact")) }} + {{ partial "functions/render_view" (dict "page" $ "item" . "view" (printf "%s-start" $.Params.view) "index" 0) }} + {{ end }} + {{ $paginator := .Paginate .Pages }} {{ range $index, $post := $paginator.Pages }} {{ partial "functions/render_view" (dict "page" $ "item" . "view" ($.Params.view | default "compact") "index" $index) }} {{end}} + {{ if templates.Exists (printf "partials/views/%s-end.html" (lower $.Params.view | default "compact")) }} + {{ partial "functions/render_view" (dict "page" $ "item" . "view" (printf "%s-end" $.Params.view) "index" 0) }} + {{ end }} + {{ partial "pagination" . }}