From 036d5bd8bd2bfc2a77c43f8dbfa8e90ae8ee8b76 Mon Sep 17 00:00:00 2001 From: tdro Date: Fri, 6 Jan 2023 03:57:02 -0500 Subject: themes/default/layouts/partials/author-list: Generate once Let it appear on second generation --- config.json | 5 +++++ config.toml | 6 +++++- config.yaml | 4 ++++ .../default/layouts/_default/home.authors.section.html | 11 +++++++++++ themes/default/layouts/partials/author-card.html | 5 ++++- themes/default/layouts/partials/author-list.html | 18 ++++++++---------- themes/default/layouts/shortcodes/version.html | 2 +- 7 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 themes/default/layouts/_default/home.authors.section.html diff --git a/config.json b/config.json index 4fd39bd..369ea15 100644 --- a/config.json +++ b/config.json @@ -231,6 +231,10 @@ "baseName": "index", "mediaType": "text/html" }, + "authors.section": { + "baseName": "authors", + "mediaType": "text/html" + }, "history": { "path": "archives/messages", "baseName": "index", @@ -275,6 +279,7 @@ "xslt.sitemap", "json", "authors", + "authors.section", "sources", "browserconfig", "history", diff --git a/config.toml b/config.toml index 8b90d6b..1e93e57 100644 --- a/config.toml +++ b/config.toml @@ -172,6 +172,10 @@ enableRobotsTXT = true baseName = "index" mediaType = "text/html" + [outputFormats."authors.section"] + baseName = "authors" + mediaType = "text/html" + [outputFormats.history] path = "archives/messages" baseName = "index" @@ -208,7 +212,7 @@ enableRobotsTXT = true mediaType = "text/html" [outputs] - home = ["html", "rss", "xslt.rss", "xslt.sitemap", "json", "authors", "sources", "browserconfig", "history", "records", "webmanifest"] + home = ["html", "rss", "xslt.rss", "xslt.sitemap", "json", "authors", "authors.section", "sources", "browserconfig", "history", "records", "webmanifest"] section = ["html", "rss", "gallery", "following", "webring"] taxonomy = ["html", "rss"] term = ["html", "rss"] diff --git a/config.yaml b/config.yaml index 897f781..452f1d0 100644 --- a/config.yaml +++ b/config.yaml @@ -151,6 +151,9 @@ outputFormats: path: authors baseName: index mediaType: text/html + authors.section: + baseName: authors + mediaType: text/html history: path: archives/messages baseName: index @@ -187,6 +190,7 @@ outputs: - xslt.sitemap - json - authors + - authors.section - sources - browserconfig - history diff --git a/themes/default/layouts/_default/home.authors.section.html b/themes/default/layouts/_default/home.authors.section.html new file mode 100644 index 0000000..8b868f9 --- /dev/null +++ b/themes/default/layouts/_default/home.authors.section.html @@ -0,0 +1,11 @@ +{{- $authors := partial "function-authors-slice.html" . -}} + +{{- range $author := first 3 (shuffle $authors) -}} +{{- $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 -}} diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html index 243d360..6f771b7 100644 --- a/themes/default/layouts/partials/author-card.html +++ b/themes/default/layouts/partials/author-card.html @@ -22,7 +22,10 @@ {{- $height = $metadata.picture.profileHeight -}} {{- end -}} -{{- if not (fileExists (print "public/" $source)) -}} +{{- if or + (not (path.Ext .Data.picture.profile)) + (not (fileExists (print "public/" (partial "function-paths.html" "media") "/" .Data.user))) +-}} {{- $source = "/data/media/404.png" -}} {{- $sourceset = "" -}} {{- end -}} diff --git a/themes/default/layouts/partials/author-list.html b/themes/default/layouts/partials/author-list.html index bd87ad5..44b55aa 100644 --- a/themes/default/layouts/partials/author-list.html +++ b/themes/default/layouts/partials/author-list.html @@ -1,16 +1,14 @@ -{{- $authors := partial "function-authors-slice.html" . -}} +{{- $authors := print "public/authors.html" -}}

Authors

diff --git a/themes/default/layouts/shortcodes/version.html b/themes/default/layouts/shortcodes/version.html index debd59a..f712c51 100644 --- a/themes/default/layouts/shortcodes/version.html +++ b/themes/default/layouts/shortcodes/version.html @@ -1,4 +1,4 @@ -{{- $version := "0.11.9" -}} +{{- $version := "0.11.10" -}} {{- $number := default false (.Get "number" | default (.Get 0)) -}} {{- $clone := default false (.Get "clone" | default (.Get 1)) -}} {{- $hugo := default false (.Get "hugo" | default (.Get 2)) -}} -- cgit v1.2.3