{{- $template := .block.template -}} {{- $position := .block.position -}} {{- $title := .block.title -}} {{- $term := false -}} {{- $layout := "grid" -}} {{- with .block.data }} {{ if .layout }} {{- $layout = .layout -}} {{ end }} {{ if .category }} {{- $term = site.GetPage (printf "/categories%s" .category) -}} {{ end }}
{{ if $title -}}
{{ $title_link := false }} {{- if $term }} {{ $title_link = $term.Permalink }} {{- else if .all -}} {{ $posts_page := site.GetPage "/posts" }} {{ $title_link = $posts_page.Permalink }} {{- end -}} {{- if $title -}} {{ partial "blocks/title_with_link.html" (dict "title" $title "link" $title_link ) }} {{ end -}}
{{- end }} {{- partial (printf "blocks/templates/posts/%s.html" $layout) . -}}
{{ end -}}