From 937d0e35700c85c7d683dd33a7f542442d8ec11c Mon Sep 17 00:00:00 2001 From: tdro Date: Sat, 30 Dec 2023 16:39:52 -0500 Subject: config: Simplify author site data --- config.json | 10 ++------ config.toml | 8 +------ config.yaml | 9 +------- themes/default/layouts/_default/home.authors.html | 2 +- .../layouts/_default/home.authors.section.html | 2 +- .../default/layouts/partials/base-discovery.html | 9 +------- themes/default/layouts/partials/base-footer.html | 12 +++++----- themes/default/layouts/partials/base-head.html | 27 +++++++++------------- themes/default/layouts/partials/base-title.html | 2 +- .../layouts/partials/function-authors-data.html | 6 ++--- 10 files changed, 27 insertions(+), 60 deletions(-) diff --git a/config.json b/config.json index 5643e14..df5cdb6 100644 --- a/config.json +++ b/config.json @@ -16,14 +16,8 @@ "nobody" ], "default": { - "footer": "canory", - "home": "canory", - "gallery": "canory", - "title": "canory", - "user": "default", - "webring": "canory" - }, - "footer": "A Micro Blog\n" + "footer": "A Micro Blog" + } }, "taxonomies": { "tag": "tags" diff --git a/config.toml b/config.toml index c92482b..8ca17e9 100644 --- a/config.toml +++ b/config.toml @@ -10,14 +10,8 @@ enableRobotsTXT = true [author] list = ["canory", "default", "nobody"] - footer = "A Micro Blog\n" [author.default] - footer = "canory" - home = "canory" - gallery = "canory" - title = "canory" - user = "default" - webring = "canory" + footer = "A Micro Blog" [taxonomies] tag = "tags" diff --git a/config.yaml b/config.yaml index 5d9baf3..6a4b691 100644 --- a/config.yaml +++ b/config.yaml @@ -17,14 +17,7 @@ author: - default - nobody default: - footer: canory - home: canory - gallery: canory - title: canory - user: default - webring: canory - footer: > - A Micro Blog + footer: A Micro Blog taxonomies: tag: tags diff --git a/themes/default/layouts/_default/home.authors.html b/themes/default/layouts/_default/home.authors.html index 87ebc3c..3854ebe 100644 --- a/themes/default/layouts/_default/home.authors.html +++ b/themes/default/layouts/_default/home.authors.html @@ -26,7 +26,7 @@ {{- $authors := partial "function-authors-slice.html" . -}} {{- range $author := $authors -}} - {{- $data := index $.Site.Data $author | default "default" -}} + {{- $data := index $.Site.Data $author -}} {{- $date := (index (first 1 (where $.Site.Pages.ByDate.Reverse "Section" $author)) 0).Date -}} {{- partial "author-card.html" (dict "Data" $data diff --git a/themes/default/layouts/_default/home.authors.section.html b/themes/default/layouts/_default/home.authors.section.html index 4374f69..20ffdc6 100644 --- a/themes/default/layouts/_default/home.authors.section.html +++ b/themes/default/layouts/_default/home.authors.section.html @@ -9,7 +9,7 @@ {{- if $modified -}} {{- range $author := first 3 $authors -}} - {{- $data := index $.Site.Data $author | default "default" -}} + {{- $data := index $.Site.Data $author -}} {{- $date := (index (first 1 (where $.Site.Pages.ByDate.Reverse "Section" $author)) 0).Date -}} {{- partial "author-card.html" (dict "Data" $data diff --git a/themes/default/layouts/partials/base-discovery.html b/themes/default/layouts/partials/base-discovery.html index 69406ef..8c7272f 100644 --- a/themes/default/layouts/partials/base-discovery.html +++ b/themes/default/layouts/partials/base-discovery.html @@ -1,11 +1,4 @@ -{{- - $authorData := (dict - "Context" . - "AuthorDefaultUser" .Site.Author.default.home - ) --}} - -{{- $author := partial "function-authors-data.html" (dict "Data" $authorData) -}} +{{- $author := partial "function-authors-data.html" . -}} {{- with (eq .Page.Kind "home") -}} - {{- with .Site.Author.footer -}} - {{- if $kind -}} - {{ . | markdownify }} · + {{- if $kind -}} + {{- with $footer := (and $kind .Site.Author.default.footer) -}} + {{ $footer | markdownify }} · Copyright © {{ now | time.Format "2006"}} · - {{- else -}} - {{ or $author.footer $author.title | markdownify }} · {{- end -}} + {{- else -}} + {{ or $author.default.footer $author.title | markdownify }} · {{- end }} Site Map diff --git a/themes/default/layouts/partials/base-head.html b/themes/default/layouts/partials/base-head.html index 1fdfe4e..0fbeb3a 100644 --- a/themes/default/layouts/partials/base-head.html +++ b/themes/default/layouts/partials/base-head.html @@ -1,20 +1,15 @@ -{{- - $authorData := (dict - "Context" . - "AuthorDefaultUser" .Site.Author.default.home - ) --}} - -{{- $author := partial "function-authors-data.html" (dict "Data" $authorData) -}} - {{- $noindex := "" -}} -{{- if or .Params.Feed .Params.Unlisted .Params.ExpiryDate -}} +{{- $author := .Section -}} +{{- $authors := partial "function-authors-data.html" . -}} +{{- $image := print ("" | absURL) "/data/media/" $author "/" $author "-profile.png" -}} + +{{- with or .Params.Feed .Params.Unlisted .Params.ExpiryDate -}} {{- $noindex = "noindex,nofollow" -}} {{- end }} - + @@ -22,14 +17,14 @@ - - + + - + @@ -38,14 +33,14 @@ - + - + {{- partial "base-search.html" . -}} diff --git a/themes/default/layouts/partials/base-title.html b/themes/default/layouts/partials/base-title.html index 79e34ca..c8736b1 100644 --- a/themes/default/layouts/partials/base-title.html +++ b/themes/default/layouts/partials/base-title.html @@ -1,4 +1,4 @@ -{{- $author := index .Site.Data ((or .Section .Site.Author.default.title) | default "default") -}} +{{- $author := index .Site.Data .Section -}} {{- if not (eq .Title $.Site.Title) -}} {{- with $title := or .Title .Summary -}} diff --git a/themes/default/layouts/partials/function-authors-data.html b/themes/default/layouts/partials/function-authors-data.html index 88af43d..d9eaade 100644 --- a/themes/default/layouts/partials/function-authors-data.html +++ b/themes/default/layouts/partials/function-authors-data.html @@ -1,11 +1,9 @@ -{{- $input := or .Data.Context . -}} +{{- $input := . -}} {{- $pageContext := $input -}} -{{- $authorDefaultUser := or .Data.AuthorDefaultUser $pageContext.Site.Author.default.user -}} - {{- $author := $pageContext.Section -}} -{{- $output := index $pageContext.Site.Data ((or $author $authorDefaultUser) | default "default") -}} +{{- $output := index $pageContext.Site.Data $author -}} {{- return $output -}} -- cgit v1.2.3