Closed embeddedpenguin closed 1 month ago
Figured out how to do this. Here's what a did:
index.html
in the layouts
folder.Here is the contents of layouts/index.html
:
{{ define "main" }}
{{ $paginator_blog := .Paginate (first 3 (where .Site.RegularPages "Section" "blog")) }}
<main class="posts">
<h1>{{ .Title }}</h1>
{{ partial "subtitle.html" . }}
{{ if .Content }}
<div class="content">{{ .Content }}</div>
{{ end }}
{{ range $paginator_blog.Pages.GroupByDate "2006" }}
<!-- Display paginated recent posts -->
<h2>Recent Blog Posts</h2>
<div class="posts-group">
<div class="post-year">{{ .Key }}</div>
<ul class="posts-list">
{{ range $paginator_blog.Pages }}
<li class="post-item">
<a href="{{.Permalink}}" class="post-item-inner">
<span class="post-title">{{ .Title }}</span>
<span class="post-day">
{{ if .Site.Params.dateformShort }}
{{ .Date.Format .Site.Params.dateformShort }}
{{ else }}
{{ .Date.Format "Jan 2"}}
{{ end }}
</span>
</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}
{{ partial "pagination-list.html" . }}
</main>
{{ end }}
I see there are issues with this same question: #239 and #184 . Any advice would be greatly appreciated.