diff options
author | tdro <tdro@noreply.example.com> | 2022-12-28 00:54:50 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-12-28 00:54:50 -0500 |
commit | c1a365ec93422bf34896caa18755fd6b1bf060ee (patch) | |
tree | 86cdc4ede2297253ffcf0a77a71b257b40ccae67 | |
parent | 773db7d222adcf5c4e47bf06dd071417831bfc60 (diff) | |
download | canory-c1a365ec93422bf34896caa18755fd6b1bf060ee.tar.gz canory-c1a365ec93422bf34896caa18755fd6b1bf060ee.tar.bz2 canory-c1a365ec93422bf34896caa18755fd6b1bf060ee.zip |
themes/default/layouts/_default/home.authors: Mix in dates
This could use the page variable directly but it might be useful
for passing stacks of variable data
-rw-r--r-- | assets/css/default.css | 8 | ||||
-rw-r--r-- | themes/default/layouts/_default/home.authors.html | 7 | ||||
-rw-r--r-- | themes/default/layouts/partials/author-card.html | 19 | ||||
-rw-r--r-- | themes/default/layouts/partials/author-list.html | 11 |
4 files changed, 36 insertions, 9 deletions
diff --git a/assets/css/default.css b/assets/css/default.css index a6e7c43..b4785b5 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -1511,12 +1511,16 @@ web-ring header { } web-ring time, -following-list time { - font-variant: small-caps; +micro-author micro-header time { + display: block; color: #444; color: var(--fade); } +web-ring time { + font-variant: small-caps; +} + web-ring p, web-ring time { display: inline; diff --git a/themes/default/layouts/_default/home.authors.html b/themes/default/layouts/_default/home.authors.html index 6eb6617..8e63d51 100644 --- a/themes/default/layouts/_default/home.authors.html +++ b/themes/default/layouts/_default/home.authors.html @@ -24,7 +24,12 @@ {{- range $author := shuffle $authors -}} {{ $data := index $.Site.Data $author | default "default" }} - {{ partial "author-card.html" (dict "Data" $data) }} + {{- $date := (index (first 1 (where $.Site.Pages.ByDate.Reverse "Section" $author)) 0).Date -}} + {{- partial "author-card.html" (dict + "Data" $data + "Date" $date + ) + -}} {{ end }} {{ end }} diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html index 2897e62..243d360 100644 --- a/themes/default/layouts/partials/author-card.html +++ b/themes/default/layouts/partials/author-card.html @@ -1,4 +1,5 @@ {{- $metadata := print "public/" .Data.user "/author.json" -}} +{{- $date := .Date.Local.Format "3:04 PM Jan 2 2006" -}} {{- $host := (urls.Parse ("" | absURL)).Host -}} @@ -26,6 +27,10 @@ {{- $sourceset = "" -}} {{- end -}} +{{- if not .Date -}} + {{- $date = "Inactive" -}} +{{- end -}} + <micro-author> <micro-card> <micro-summary> @@ -37,8 +42,8 @@ <source srcset="{{ $sourceset }}" type="image/webp" /> {{- end -}} <img - width="{{ $width }}" - height="{{ $height }}" + width="{{ or $width "64" }}" + height="{{ or $height "64" }}" src="{{ $source }}" alt="{{ $alternate }}" /> @@ -51,8 +56,16 @@ <b>{{ .Data.name }}</b> </h2> <h3> - <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/#">{{ .Data.user }}@{{ $host }}</a> + <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/#"> + {{ .Data.user }}@{{ $host }} + </a> </h3> + <time + title="{{ .Date.Format "Monday, January 2 2006 at 15:04:05 MST" }}" + datetime="{{ .Date.Format "2006-01-02T15:04:05Z" }}" + > + {{ $date }} + </time> </micro-header> <p>{{ .Data.description | markdownify | plainify | htmlUnescape | truncate 60 "..." }}</p> <a title="Follow with RSS Reader" href="{{ "" | absURL }}/{{ .Data.user }}/rss.xml"> diff --git a/themes/default/layouts/partials/author-list.html b/themes/default/layouts/partials/author-list.html index 37e3222..bd87ad5 100644 --- a/themes/default/layouts/partials/author-list.html +++ b/themes/default/layouts/partials/author-list.html @@ -4,8 +4,13 @@ <h1>Authors</h1> <aside> {{- range $author := first 3 (shuffle $authors) -}} - {{ $data := index $.Site.Data $author | default "default" }} - {{ partial "author-card.html" (dict "Data" $data) }} - {{ end }} + {{- $data := index $.Site.Data $author | default "default" -}} + {{- $date := (index (first 1 (where $.Site.Pages.ByDate.Reverse "Section" $author)) 0).Date -}} + {{- partial "author-card.html" (dict + "Data" $data + "Date" $date + ) + -}} + {{- end -}} </aside> </author-list> |