I see what you mean. Thanks for the extra information that helped me understand better.
This is what I have in my /layouts/index.html
:
{{ define "main" }}
{{ $posts := where site.RegularPages "Type" "post" }}
{{ $grouped := $posts.GroupByDate "2006-01-02" }}
{{ $paginated := (.Paginate ($grouped)) }}
<main class="content" role="main">
{{ range $paginated.PageGroups }}
{{ $thedate := (time .Key) }}
<h3 class="post-group"> {{ $thedate.Format "January 2, 2006" }}</h3>
{{ range .Pages.Reverse }}
{{ if eq .Type "post" }}
{{ .Render "article" }}
{{- end }}
{{ end }}
{{ end }}
</div>
{{ partial "pagination.html" . }}
{{ end }}
So I then head to the /layouts/post/article
, I have this:
<article class="h-entry post">
<header class="post-header">
{{ with .Params.image }}
<img class="u-featured" src="{{ . }}"></img>
{{ end }}
<h2 class="p-name post-title"><a href="{{ .URL }}">{{ .Title }}</a></h2>
</header>
<section class="e-content post-content">
<a href="{{ .Permalink }}" class="u-url read-more"><span class="dt-published" datetime="{{ .Date.Format "2006-01-02T15:04:05-0700" }}">{{ .Date.Format "03:04 PM" }} ▸</span></a>
{{ .Content }}
{{ if .Truncated }}
<p><a href="{{ .RelPermalink }}">Read More</a></p>
{{ end }}
</section>
<footer class="post-meta">
</footer>
</article>
I added the code below after {{ .Content }}
. As you predicted, the truncate code below doesn’t work. It does work when I use {{ .Summary }}
but that also “summarizes” all posts regardless of <!--more-->
{{ if .Truncated }}
<p><a href="{{ .RelPermalink }}">Read More</a></p>
{{ end }}
The /layouts/post/summary.html
does have {{ .Content }}
as the body so I’m not sure how Summary is being determined.