www.byjp.me/layouts/partials/post-previews.html
2024-04-07 10:46:19 +01:00

81 lines
No EOL
3.8 KiB
HTML

<div class="previews">
<p class="intro">
This site is a much loved wild garden; things aren't perfectly orgnaised, there are lots of nooks and crannies to explore. Follow your nose and see where you end up.
</p>
<ol class="small-post-list">
{{- $posts := where .Site.RegularPages "Section" "in" (slice "posts" "bookmarks" "poetry") -}}
{{- range $posts.ByPublishDate.Reverse | first 6 -}}
{{- $postType := partial "post-type.txt" . -}}
{{- $typeSVG := index .Site.Params.defaultSVG ( partial "kebab.txt" $postType) -}}
<li>
{{ partial "svg.html" (dict "name" $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 | htmlUnescape -}}
</div>
</li>
{{- end -}}
</ol>
{{- $allEvents := where .Site.RegularPages "Section" "calendar" -}}
{{- $upcomingEvents := slice }}
{{- range $eventPage := $allEvents -}}
{{ range $eventPage.Params.timings }}
{{ $event := dict "Title" $eventPage.Title "Page" $eventPage.Page "Date" (time.AsTime .starts) "Duration" (partial "iso8601.duration" .duration) }}
{{ if $event.Date.Before time.Now }}{{ continue }}{{ end }}
{{ $upcomingEvents = sort ($upcomingEvents | append $event) "Date" "asc" }}
{{ break }}{{/* Only show the first on the list */}}
{{ end }}
{{- end -}}
{{ if ge (len $upcomingEvents) 2 }}
<hr class="mini" />
<p class="post-content">
{{ partial "svg.html" (dict "name" "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">{{ partial "svg.html" (dict "name" "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 -}}
<img src="{{ path.Join .RelPermalink $src.url }}" {{ with $src.alt }}alt="{{ . }}" {{ end }} />
<figcaption>
{{- index (split .Summary "\n") 0 | htmlUnescape }}
</figcaption>
</figure>
</div>
{{- end -}}
{{- $notePage := index (where .Site.RegularPages "Section" "eq" "notes") 0 -}}
{{- with $notePage -}}
<div class="note">
<div class="context">{{ partial "svg.html" (dict "name" "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>