diff options
| author | tdro <tdro@noreply.example.com> | 2024-06-13 00:00:00 +0000 |
|---|---|---|
| committer | tdro <tdro@noreply.example.com> | 2024-06-13 00:00:00 +0000 |
| commit | 1c848351cc19aa66c96f78161e6909c6b751b8d4 (patch) | |
| tree | 16e6143cce67dce7fbf4303747fbddda483c4298 | |
| parent | 44b0f03af994e1b6ab685183af4f26a8d82e3372 (diff) | |
| download | canory-1c848351cc19aa66c96f78161e6909c6b751b8d4.tar.gz canory-1c848351cc19aa66c96f78161e6909c6b751b8d4.tar.bz2 canory-1c848351cc19aa66c96f78161e6909c6b751b8d4.zip | |
themes/default/layouts/_default/home.authors: Fix timestamps
| -rw-r--r-- | themes/default/layouts/_default/home.authors.html | 13 | ||||
| -rw-r--r-- | themes/default/layouts/_default/home.authors.section.html | 21 | ||||
| -rw-r--r-- | themes/default/layouts/partials/author-card.html | 19 | ||||
| -rw-r--r-- | themes/default/layouts/partials/author-data.html | 23 |
4 files changed, 34 insertions, 42 deletions
diff --git a/themes/default/layouts/_default/home.authors.html b/themes/default/layouts/_default/home.authors.html index 0662285..821e60e 100644 --- a/themes/default/layouts/_default/home.authors.html +++ b/themes/default/layouts/_default/home.authors.html @@ -22,18 +22,7 @@ {{- define "middle" -}} {{- partial "generate-authors" . -}} - - {{- $authors := partial "function-authors-slice.html" . -}} - - {{- range $author := $authors -}} - {{- $data := index $.Site.Data.authors $author -}} - {{- $date := (index (first 1 (where $.Site.Pages.ByDate.Reverse "Section" $author)) 0).Date -}} - {{- partial "author-card.html" (dict - "Data" $data - "Date" $date - ) - -}} - {{- end -}} + {{- partial "author-data.html" . -}} {{- end -}} {{- define "right" -}} diff --git a/themes/default/layouts/_default/home.authors.section.html b/themes/default/layouts/_default/home.authors.section.html index b0b1161..230892c 100644 --- a/themes/default/layouts/_default/home.authors.section.html +++ b/themes/default/layouts/_default/home.authors.section.html @@ -1,20 +1 @@ -{{- $authors := partial "function-authors-slice.html" . -}} - -{{- $modified := partial "function-page-modified.html" - (dict - "Context" . - "Disable" true - ) --}} - -{{- if $modified -}} - {{- range $author := first 3 $authors -}} - {{- $data := index $.Site.Data.authors $author -}} - {{- $date := (index (first 1 (where $.Site.Pages.ByDate.Reverse "Section" $author)) 0).Date -}} - {{- partial "author-card.html" (dict - "Data" $data - "Date" $date - ) - -}} - {{- end -}} -{{- end -}} +{{- partial "author-data.html" . -}} diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html index c4bcaab..1fcfb72 100644 --- a/themes/default/layouts/partials/author-card.html +++ b/themes/default/layouts/partials/author-card.html @@ -1,26 +1,25 @@ +{{- $host := (urls.Parse $.Site.BaseURL).Host -}} +{{- $date := .Date | time.Format "Mon Jan 2 2006" -}} {{- $metadata := print "public/" .Data.user "/author.json" -}} -{{- $date := .Date | time.Format "Mon Jan 2 2006" -}} - -{{- $host := (urls.Parse ("" | absURL)).Host -}} {{- if not $host -}} {{- $host = "localhost" -}} {{- end -}} {{- $alternate := .Data.name -}} -{{- $width := "" -}} -{{- $height := "" -}} -{{- $source := "" -}} +{{- $width := "" -}} +{{- $height := "" -}} +{{- $source := "" -}} {{- $sourceset := "" -}} -{{- $source = print "/" (partial "function-paths.html").media "/" .Data.user "/" .Data.user "-profile" (path.Ext .Data.picture.profile) -}} +{{- $source = print "/" (partial "function-paths.html").media "/" .Data.user "/" .Data.user "-profile" (path.Ext .Data.picture.profile) -}} {{- $sourceset = print "/" (partial "function-paths.html").media "/" .Data.user "/" .Data.user "-profile.webp" -}} {{- with $metadata := resources.Get $metadata -}} {{- with $content := $metadata.Content -}} - {{- $metadata = $content | transform.Unmarshal -}} - {{- $width = $metadata.picture.profileWidth -}} - {{- $height = $metadata.picture.profileHeight -}} + {{- $metadata = $content | transform.Unmarshal -}} + {{- $width = $metadata.picture.profileWidth -}} + {{- $height = $metadata.picture.profileHeight -}} {{- end -}} {{- end -}} diff --git a/themes/default/layouts/partials/author-data.html b/themes/default/layouts/partials/author-data.html new file mode 100644 index 0000000..60a6cfb --- /dev/null +++ b/themes/default/layouts/partials/author-data.html @@ -0,0 +1,23 @@ +{{- $authors := partial "function-authors-slice.html" . -}} +{{- $modified := partial "function-page-modified.html" + (dict + "Context" . + "Disable" true + ) +-}} + +{{- if $modified -}} + {{- range $author := first 3 $authors -}} + {{- $recent := where $.Site.RegularPages.ByDate.Reverse "Section" $author -}} + {{- $recent = where $recent "Params.feed" "eq" nil -}} + + {{- $data := index $.Site.Data.authors $author -}} + {{- $date := or (index (first 1 ($recent)) 0).Date 0 -}} + + {{- partial "author-card.html" (dict + "Data" $data + "Date" $date + ) + -}} + {{- end -}} +{{- end -}} |
