From ca54b70d5635b9e940ae6a1a2a327186c0da99ce Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sun, 16 Nov 2025 19:01:32 -0700 Subject: [PATCH] Add logic for Default author. Make parameter lowercase for easy of validation. --- layouts/partials/byline.html | 12 +++++++----- layouts/shortcodes/author.html | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/layouts/partials/byline.html b/layouts/partials/byline.html index 2a299c7..6400fb8 100644 --- a/layouts/partials/byline.html +++ b/layouts/partials/byline.html @@ -1,12 +1,14 @@ -{{ $author := .Page.Params.author -}}{{ if or (eq $author "authorBug") (eq $author "bug") +{{ $author := (lower .Page.Params.author) +}}{{ if or (eq $author "authorbug") (eq $author "bug") }}{{ .Scratch.Set "author" .Site.Params.authorBug -}}{{ else if or (eq $author "authorHyperling") (eq $author "hyperling") +}}{{ else if or (eq $author "authorhyperling") (eq $author "hyperling") }}{{ .Scratch.Set "author" .Site.Params.authorHyperling -}}{{ else if or (eq $author "authorHyperVegan") (eq $author "hypervegan") +}}{{ else if or (eq $author "authorhypervegan") (eq $author "hypervegan") }}{{ .Scratch.Set "author" .Site.Params.authorHyperVegan -}}{{ else +}}{{ else if and ($author) (not (eq $author "")) }}{{ .Scratch.Set "author" $author +}}{{ else +}}{{ .Scratch.Set "author" .Site.Params.authorDefault }}{{ end }}{{ $author := .Scratch.Get "author" }}{{ if $author diff --git a/layouts/shortcodes/author.html b/layouts/shortcodes/author.html index c3052ac..7ece4d4 100644 --- a/layouts/shortcodes/author.html +++ b/layouts/shortcodes/author.html @@ -1,12 +1,14 @@ -{{ $author := .Get 0 -}}{{ if or (eq $author "authorBug") (eq $author "bug") +{{ $author := (lower (.Get 0)) +}}{{ if or (eq $author "authorbug") (eq $author "bug") }}{{ .Scratch.Set "author" .Site.Params.authorBug -}}{{ else if or (eq $author "authorHyperling") (eq $author "hyperling") +}}{{ else if or (eq $author "authorhyperling") (eq $author "hyperling") }}{{ .Scratch.Set "author" .Site.Params.authorHyperling -}}{{ else if or (eq $author "authorHyperVegan") (eq $author "hypervegan") +}}{{ else if or (eq $author "authorhypervegan") (eq $author "hypervegan") }}{{ .Scratch.Set "author" .Site.Params.authorHyperVegan -}}{{ else +}}{{ else if and ($author) (not (eq $author "")) }}{{ .Scratch.Set "author" $author +}}{{ else +}}{{ .Scratch.Set "author" .Site.Params.authorDefault }}{{ end }}{{ $author := .Scratch.Get "author" }}{{ if $author