Files
jcoffey-dev 6f1fe0ac43
ci / go (pull_request) Successful in 48s
ci / editor-ui (pull_request) Successful in 1m11s
Three packs: breadcrumbs, author box and series
breadcrumbs puts a Home › Articles › This page trail above a page's title
and gives search engines the same trail (BreadcrumbList) once installed.
author-box shows who wrote an article, at its end, from data/authors.yaml:
the author its front matter names, by id or name, else the site's author.
series shows "Part 2 of 5" in a series, every part, and the previous and
next part; parts follow their part: numbers, or go oldest first.

Two template functions they're built on: trail . (the pages above a page,
by address) and series . (a page's series, in reading order).
2026-10-14 13:28:35 -07:00

23 lines
1.7 KiB
HTML

{{/* Who wrote this page, from data/authors.yaml: the ones its front matter names
(author: or authors:, by id or name), else the site's author. */}}
{{ with index .Site.Data "authors" }}{{ $all := . }}
{{ $want := list }}{{ with $.Params.authors }}{{ if kindIs "list" . }}{{ $want = . }}{{ else }}{{ $want = list . }}{{ end }}{{ else }}{{ with $.Params.author }}{{ $want = list . }}{{ else }}{{ with $.Site.Config.Author }}{{ $want = list . }}{{ end }}{{ end }}{{ end }}
{{ $people := list }}
{{ range $want }}{{ $w := print . }}{{ with index $all $w }}{{ $people = append $people . }}{{ else }}{{ range $id, $a := $all }}{{ if eq (print $a.name) $w }}{{ $people = append $people $a }}{{ end }}{{ end }}{{ end }}{{ end }}
{{ with $people }}
<link rel="stylesheet" href="{{ asset "packs/author-box/author-box.css" }}">
<aside class="author-box" aria-label="About the author{{ if gt (len .) 1 }}s{{ end }}">
{{ range $a := . }}
<div class="ab-person">
{{ with .photo }}<img class="ab-photo" src="{{ . }}" alt="{{ default "" $a.photo_alt }}" loading="lazy" width="72" height="72">{{ else }}<span class="ab-photo ab-initial" aria-hidden="true">{{ upper (printf "%.1s" (print $a.name)) }}</span>{{ end }}
<div class="ab-text">
<p class="ab-label">Written by</p>
<p class="ab-name">{{ with .page }}<a href="{{ . }}" rel="author">{{ $a.name }}</a>{{ else }}{{ .name }}{{ end }}{{ with .role }} <span class="ab-role">· {{ . }}</span>{{ end }}</p>
{{ with .bio }}<div class="ab-bio">{{ markdownify . }}</div>{{ end }}
{{ with .links }}<ul class="ab-links">{{ range . }}<li><a href="{{ .url }}">{{ .name }}</a></li>{{ end }}</ul>{{ end }}
</div>
</div>
{{ end }}
</aside>
{{ end }}{{ end }}