{{- /* List of specified number of the most recent and published posts. Accepts a dict with the following optional parameters: @context {int} count: Number of posts to display (default: 10). @context {string} title: Section title (default: "Recent Articles"). @context {bool} show_view_all: Whether to show "View All Posts" link (default: true). @example: {{ partial "list/recent-posts.html" (dict "count" 20 "title" "Latest updates" "show_view_all" true) }} */ -}} {{- $count := .count | default 10 -}} {{- $title := .title | default (lang.Translate "posts.recent" | default "Recent Articles") -}} {{- $showViewAll := .show_view_all | default true -}}

{{ $title }}

{{- $recentPosts := where site.RegularPages "Params.excludeFromLists" "!=" true | first $count }} {{- if $recentPosts }}
{{- if $showViewAll }} {{- with site.GetPage "/all-posts"}} {{ lang.Translate "posts.view_all" | default "View all posts" }} ยป {{- end }} {{- end }}
{{ else }}

{{ lang.Translate "list.empty" | default "No posts in this section." }}

{{- end }}