{{- $block := .block -}} {{- $block_class := partial "GetBlockClass" .block -}} {{- $term := false -}} {{- $layout := .block.data.layout | default "grid" -}} {{- with .block.data }} {{ if .category }} {{- $term = site.GetPage (printf "/posts_categories%s" .category) -}} {{ end }}
{{ if $block.title -}} {{ $link := false }} {{- if $term }} {{ $link = $term.Permalink }} {{- else if .all -}} {{ $posts_page := site.GetPage "/posts" }} {{ $link = $posts_page.Permalink }} {{- end -}} {{ partial "blocks/top.html" (dict "title" $block.title "heading_level" $block.ranks.self "link" $link )}} {{- end }} {{ if eq .mode "categories" }} {{ else if .posts }} {{ partial (printf "blocks/templates/posts/%s.html" $layout) (dict "posts" .posts "heading_level" $block.ranks.children )}} {{ end }}
{{ end -}}