How to only show content in posts/ subdirectory under recent posts


I’m working with the Minima theme and I would like to configure the theme so that only posts within the content/posts subdirectory are shown under “Recent Posts” on the landing page.

This is what layouts/index.html in the theme’s folder looks like at the moment:

{{ define "main" }}
		<h2 class="mb-0">{{ .Site.Params.iam }} {{ }}</h2>
		<p>{{ .Site.Author.slogon }}</p>
		<p>{{ .Site.Author.description | markdownify | safeHTML }}</p>
		{{ if eq .Paginator.PageNumber 1 }}
		<h3>Recent Posts</h3>
		{{ else }}
		<h3>All Posts</h3>
		{{ end }}
			{{ $paginator := .Paginate (where .Site.RegularPages "Kind" "page") }}
			{{ range $paginator.Pages }}
				<div class="row row-mob mb-1 mb-1_5-mob gap-3">
					<div class="sm-2-mob mb-0_5-mob mw-6">{{ dateFormat "Jan 2, 2006" .Date }}</div>
					<a href="{{ .RelPermalink }}">{{ .Title }}</a>
			{{ end }}
			{{ partial "paginator.html" . }}
{{ end }}

I’m a bit lost so any help or guidance would be greatly appreciated.

I suppose your best chance of a fast and reliable response would be to ask the theme’s author directly.

Otherwise, you could try to modify index.html so that it uses where (where Site.RegularPages "Kind" "page") "Section" "posts" or something similar. The section on nesting where in the documentation might help.

1 Like