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.)
This commit is contained in:
George Cushen committed 2022-09-28 23:19:28 +01:00
1 parent 230d4a35ce
commit 848a7c6a2a
1 file changed
+9
@@ -7,11 +7,20 @@
<div class="article-style">{{ . }}</div>
{{ 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" . }}
</div>