matthew.paste.lol / truncate.html · 6 months ago·

{{ define "main" }}
<div class="posts h-feed">
    <div class="post_list" role="main">
        {{ $paginator := .Paginate (where .Site.Pages.ByDate.Reverse "Type" "post") (index .Site.Params "archive-paginate" | default 20) }}
        {{ range $paginator.Pages  }}
        <div class="post-preview h-entry {{ range .Params.categories }} {{ . | urlize | lower }}{{ end }}">
          <a href="{{ .Permalink }}" class="post-date u-url"><time class="dt-published" datetime="{{ .Date.Format "2006-01-02 15:04:05 -0700" }}">{{ .Date.Format "Jan 2, 2006" }}</time> ∞</a>
          {{ if .Title }}
          <h2 class="post-title p-name"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
          {{ if templates.Exists "partials/summary.html" }}
          <div class="p-summary">
{{ if .Truncated }}
            <p><a class="read-more" href="{{ .Permalink }}">{{ .Site.Params.read_more_text | safeHTML }}</a></p>
            {{ end }}

            {{ .Summary | safeHTML }}
            {{ if .Truncated }}
            <p><a class="read-more" href="{{ .Permalink }}">{{ .Site.Params.read_more_text | safeHTML }}</a></p>
            {{ end }}
          </div>
          {{ else }}
		{{ if .Truncated }}
{{ .Summary | safeHTML }}
            <p><a class="read-more" href="{{ .Permalink }}">Read More</a></p>
            {{ else }}
          <div class="e-content">
            {{ .Content }}
          </div>
{{ end }}
          {{ end }}
          {{ else }}
          <div class="e-content">
            {{ .Content }}
          </div>
          {{ end }}
        </div>
        {{ end }}
    </div>
</div>
<div class="post-nav">
    {{ if $paginator.HasPrev }}
    <span class="prev">
        <a href="{{ $paginator.Prev.URL }}" title="Previous Page"><span class="arrow">← Newer Posts</span></a>
    </span>
    {{ end }}
    {{ if $paginator.HasNext }}
    <span class="next">
        <a href="{{ $paginator.Next.URL }}"><span class="arrow">Older Posts →</span></a>
    </span>
    {{ end }}
</div>
{{ end }}