diff options
author | tdro <tdro@noreply.example.com> | 2023-12-30 16:39:52 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-12-30 16:39:52 -0500 |
commit | 937d0e35700c85c7d683dd33a7f542442d8ec11c (patch) | |
tree | d9b071862fdd2b51b9d0f9fb864cfbf4fb5a0df6 | |
parent | 3b43bb9fbe661cb35201082fca9b0924da22bb03 (diff) | |
download | canory-937d0e35700c85c7d683dd33a7f542442d8ec11c.tar.gz canory-937d0e35700c85c7d683dd33a7f542442d8ec11c.tar.bz2 canory-937d0e35700c85c7d683dd33a7f542442d8ec11c.zip |
config: Simplify author site data
-rw-r--r-- | config.json | 10 | ||||
-rw-r--r-- | config.toml | 8 | ||||
-rw-r--r-- | config.yaml | 9 | ||||
-rw-r--r-- | themes/default/layouts/_default/home.authors.html | 2 | ||||
-rw-r--r-- | themes/default/layouts/_default/home.authors.section.html | 2 | ||||
-rw-r--r-- | themes/default/layouts/partials/base-discovery.html | 9 | ||||
-rw-r--r-- | themes/default/layouts/partials/base-footer.html | 12 | ||||
-rw-r--r-- | themes/default/layouts/partials/base-head.html | 27 | ||||
-rw-r--r-- | themes/default/layouts/partials/base-title.html | 2 | ||||
-rw-r--r-- | themes/default/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") -}} <link diff --git a/themes/default/layouts/partials/base-footer.html b/themes/default/layouts/partials/base-footer.html index 53b3b2f..3873153 100644 --- a/themes/default/layouts/partials/base-footer.html +++ b/themes/default/layouts/partials/base-footer.html @@ -1,14 +1,14 @@ {{- $kind := in (slice "home" "taxonomy" "term") .Page.Kind -}} -{{- $author := index .Site.Data ((or .Section .Site.Author.default.footer) | default "default") -}} +{{- $author := index .Site.Data .Section -}} <footer> - {{- 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 }} <a href="/sitemap.xml" >Site Map</a> </footer> 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 }} <!-- HTML Meta Tags --> <meta charset="utf-8" /> -<meta name="author" content="{{ $author.name -}}" /> +<meta name="author" content="{{ $authors.name -}}" /> <meta name="robots" content="{{ or $noindex .Site.Params.site.robots "index,follow" }}" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="keywords" content="{{- partial "base-title.html" . -}}" /> @@ -22,14 +17,14 @@ <!-- Search Engine Tags --> <meta itemprop="name" content="{{ partial "base-title.html" . -}}" /> -<meta itemprop="description" content="{{ if .Params.summary }}{{ .Params.summary }}{{ else }}{{ .Summary }}{{ end }}" /> -<meta itemprop="image" content="{{ .Site.BaseURL }}/{{ $author.user -}}/media/profile/picture.png" /> +<meta itemprop="description" content="{{- partial "base-description.html" . -}}" /> +<meta itemprop="image" content="{{ $image }}" /> <!-- Open Graph Meta Tags --> <meta property="og:title" content="{{ partial "base-title.html" . -}}" /> <meta property="og:description" content="{{- partial "base-description.html" . -}}" /> <meta property="og:url" content="{{ .Permalink }}" /> -<meta property="og:image" content="{{ .Site.BaseURL }}/{{ $author.user -}}/media/profile/picture.png" /> +<meta property="og:image" content="{{ $image }}" /> <meta property="og:type" content="website" /> <meta property="article:published_time" content="{{ (or .Params.PublishDate now.UTC) | time.Format "2006-01-02T15:04:05Z" }}" /> <meta property="article:modified_time " content="{{ (or .Params.LastMod now.UTC) | time.Format "2006-01-02T15:04:05Z" }}" /> @@ -38,14 +33,14 @@ <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:title" content="{{ partial "base-title.html" . -}}" /> <meta name="twitter:description" content="{{- partial "base-description.html" . -}}" /> -<meta name="twitter:image" content="{{ .Site.BaseURL }}/{{ $author.user -}}/media/profile/picture.png" /> +<meta name="twitter:image" content="{{ $image }}" /> <!-- Extra Meta Tags --> <meta name='base-url' content="{{ "" | absURL }}" /> <meta name='last-modified' content="{{ now.UTC.Format "Mon, 02 Jan 2006 15:04:05 GMT" }}" /> <!-- Link Tags --> -<link rel="home" href="{{ .Site.BaseURL }}/{{ $author.user }}/" /> +<link rel="home" href="{{ "" | absURL }}/{{ $authors.user }}/" /> <!-- Search Verification --> {{- 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 -}} |