diff --git a/config.yaml b/config.yaml index a5dc410cd2fd08101410a1e77f10d75d345d9203..5e5ad708a803c3ee44ce72286170fe61f48fcdd7 100644 --- a/config.yaml +++ b/config.yaml @@ -55,6 +55,7 @@ params: default_image: false index: truncate_description: 200 # Set to 0 to disable truncate + layout: grid # grid | list papers: default_image: false sidebar: diff --git a/layouts/partials/blocks/templates/pages/list.html b/layouts/partials/blocks/templates/pages/list.html index 0314906c6715a009eeeb5ec398ccc1e117bec5c7..11b375e310547fe6ab33c7f915818305768689d2 100644 --- a/layouts/partials/blocks/templates/pages/list.html +++ b/layouts/partials/blocks/templates/pages/list.html @@ -7,7 +7,15 @@ )}} <ul class="list {{ if and (not $show_descriptions) (not $show_images) }} title-only {{ end }}"> {{ range .pages }} - {{ $page := site.GetPage .file }} + {{- $file := false -}} + {{/* Check if . is a map or page url, necessary when pages/grid is called outside block context */}} + {{ if reflect.IsMap . }} + {{ $file = .file }} + {{ else }} + {{ $file = . }} + {{ end }} + + {{ $page := site.GetPage $file }} {{ with $page }} <li> {{ if or $show_descriptions $show_images }} diff --git a/layouts/partials/pages/children.html b/layouts/partials/pages/children.html index fb6dd823c79574a7bf0327742e3b60f5d548817b..84c53adfe3a2b85add42b2b4312e7c950478443e 100644 --- a/layouts/partials/pages/children.html +++ b/layouts/partials/pages/children.html @@ -2,13 +2,14 @@ {{ if .Params.bodyclass }} {{- $page_class = printf "block-page-%s" .Params.bodyclass }} {{ end }} +{{ $show_images := eq site.Params.pages.index.layout "grid" }} -<div class="block block-pages block-pages--grid {{ $page_class }}"> +<div class="block block-pages block-pages--children block-pages--{{ site.Params.pages.index.layout }} {{ $page_class }}"> <div class="container"> <div class="block-content"> - {{- partial "blocks/templates/pages/grid.html" (dict + {{- partial (printf "blocks/templates/pages/%s.html" site.Params.pages.index.layout) (dict "pages" .Params.children - "show_images" true + "show_images" $show_images "heading_level" 2 "show_descriptions" true ) }}