www.byjp.me/layouts/partials/post-previews.html
2025-01-20 21:10:24 +00:00

70 lines
No EOL
3.6 KiB
HTML

<div class="previews">
{{ partial "intro.html" }}
<ol class="small-post-list">
{{- $posts := where .Site.RegularPages "Section" "in" (slice "posts" "bookmarks" "poetry" "reviews") -}}
{{- range $posts.ByDate.Reverse | first 6 -}}
{{- $postType := partial "post-type.txt" . -}}
{{- $typeSVG := index .Site.Params.defaultSVG ( partial "kebab.txt" ($postType | singularize)) -}}
<li>
{{ partialCached "svg.html" (dict "name" $typeSVG) $typeSVG }}
<a href="{{.RelPermalink}}">
{{- with .Title -}}{{ . }}{{ else }}{{ .Type | singularize | title }}{{ end -}}
</a>
<div class="summary">
<div>
<span class="always-accented">{{ $postType }}</span>
<date datetime="{{ dateFormat "2006-01-02T15:04:05-0700" .Date }}" title="Posted on {{ dateFormat "Monday Jan 2 2006 at 03:04 MST" .Date }}" data-pagefind-sort="date">
{{ partial "year-relative-date.html" .Date }}
</date>
</div>
{{- index (split .Summary "\n") 0 | safeHTML -}}
</div>
</li>
{{- end -}}
</ol>
<p class="post-content">{{ partialCached "svg.html" (dict "name" "document") "document" }} Check out <a href="/posts">all my longer posts</a>, or read through my <a href="/bookmarks">thoughts on others' writing</a>.</p>
{{- $upcomingEvents := partial "upcoming-events.obj" }}
{{ if ge (len $upcomingEvents) 2 }}
<hr class="mini" />
<p class="post-content">
{{ partialCached "svg.html" (dict "name" "calendar") "calendar" }}
Maybe you'll see me at
<a href="{{ (index $upcomingEvents 0).Page.RelPermalink }}">{{ (index $upcomingEvents 0).Title }}</a> on {{ partial "year-relative-date.html" (index $upcomingEvents 0).Date }}, or
<a href="{{ (index $upcomingEvents 1).Page.RelPermalink }}">{{ (index $upcomingEvents 1).Title }}</a> on {{ partial "year-relative-date.html" (index $upcomingEvents 1).Date }}.
Get in touch if you'd like to go to these, or any other <a href="/calendar">events</a>, together!
</p>
{{ end }}
<hr class="mini" />
<div class="passing">
{{- $picPage := index (where .Site.RegularPages "Section" "eq" "photos") 0 -}}
{{- with $picPage -}}
<div class="photo">
<div class="context">{{ partialCached "svg.html" (dict "name" "camera") "camera" }} <a href="{{ .RelPermalink }}"><date datetime="{{ dateFormat "2006-01-02T15:04:05-0700" .Date }}" title="Posted on {{ dateFormat "Monday Jan 2 2006 at 03:04 MST" .Date }}" data-pagefind-sort="date">{{ partial "year-relative-date.html" .Date }}</date></a></div>
<figure>
{{- $src := index $picPage.Params.Media 0 -}}
<a href="{{ .RelPermalink }}"><img src="{{ path.Join .RelPermalink $src.url }}" {{ with $src.alt }}alt="{{ . }}" {{ end }} /></a>
<figcaption>
{{- $shortSummary := index (split .Summary "</p>") 0 -}}
{{- $shortSummary | plainify | htmlUnescape | strings.TrimSpace }}&nbsp;<a href="{{ .RelPermalink }}"></a>
</figcaption>
</figure>
</div>
{{- end -}}
{{- with (partial "latest-non-reply-note.obj") -}}
<div class="note">
<div class="context">{{ partialCached "svg.html" (dict "name" "message") "message" }} <a href="{{ .RelPermalink }}"><date datetime="{{ dateFormat "2006-01-02T15:04:05-0700" .Date }}" title="Posted on {{ dateFormat "Monday Jan 2 2006 at 03:04 MST" .Date }}" data-pagefind-sort="date">
{{ partial "year-relative-date.html" .Date }}</date></a>
</div>
{{ .Content}}
</div>
{{- end -}}
</div>
</div>