{{- $posts := "" -}} {{- if .section -}} {{- $posts = (where site.RegularPages "Section" .section) -}} {{- else -}} {{- if (eq .context.Kind "taxonomy") -}} {{- $posts = .context.Pages -}} {{- else -}} {{- if (eq .context.Kind "term") -}} {{- $posts = .context.Data.Pages -}} {{- else -}} {{- $posts = site.RegularPages }} {{- end -}} {{- end -}} {{- end -}} {{- $limit_exceeded:= "" -}} {{- if (and .limit (gt (len $posts) .limit)) -}} {{- $limit_exceeded = true -}} {{- else -}} {{- $limit_exceeded = false -}} {{ end }} {{- if (gt (len $posts) 0) }} {{- if .limit }} {{ $posts = (first .limit $posts ) }} {{ end }}