From 731cc69cb8fc3ea1de8efc6ab2c57f2f4c68f297 Mon Sep 17 00:00:00 2001
From: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Fri, 30 Oct 2026 06:18:41 +0000
Subject: [PATCH] 🧹 [Code Health] Extract author name logic to a partial

---
 layouts/_default/rss.xml     |   11 +----------
 layouts/partials/schema.html |   11 +----------
 layouts/partials/author.html |   11 +++++++++++
 layouts/partials/head.html   |   11 +----------
 layouts/partials/footer.html |   11 +----------
 5 files changed, 15 insertions(+), 40 deletions(-)

diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
index 1826550..b14b36b 100644
--- a/layouts/_default/rss.xml
+++ b/layouts/_default/rss.xml
@@ -6,16 +6,7 @@
     {{- end -}}
   {{- end -}}
 {{- end -}}
-{{- $authorName := "" -}}
-{{- with site.Params.author -}}
-  {{- if reflect.IsMap . -}}
-    {{- with .name -}}
-      {{- $authorName = . -}}
-    {{- end -}}
-  {{- else -}}
-    {{- $authorName = . -}}
-  {{- end -}}
-{{- end -}}
+{{- $authorName := partial "author.html" site.Params.author -}}
 {{- $pctx := . -}}
 {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
 {{- $pages := slice -}}
diff --git a/layouts/partials/author.html b/layouts/partials/author.html
new file mode 100644
index 0000000..454db2f
--- /dev/null
+++ b/layouts/partials/author.html
@@ -0,0 +1,11 @@
+{{- $authorName := "" -}}
+{{- with . -}}
+  {{- if reflect.IsMap . -}}
+    {{- with .name -}}
+      {{- $authorName = . -}}
+    {{- end -}}
+  {{- else -}}
+    {{- $authorName = . -}}
+  {{- end -}}
+{{- end -}}
+{{- return $authorName -}}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 53a0807..7cfcf05 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,13 +1,4 @@
-{{- $authorName := "" -}}
-{{- with .context.Site.Params.author -}}
-  {{- if reflect.IsMap . -}}
-    {{- with .name -}}
-      {{- $authorName = . -}}
-    {{- end -}}
-  {{- else -}}
-    {{- $authorName = . -}}
-  {{- end -}}
-{{- end -}}
+{{- $authorName := partial "author.html" .context.Site.Params.author -}}
 <footer class="footer footer__{{ .footerClassModifier }}">
   <ul
     class="footer__list {{ with .context.Site.Params.doNotLoadAnimations }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index dcea3c9..c41cd73 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -1,15 +1,6 @@
 <head>
   <meta charset="utf-8" />
-  {{- $authorName := "" -}}
-  {{- with .Site.Params.author -}}
-    {{- if reflect.IsMap . -}}
-      {{- with .name -}}
-        {{- $authorName = . -}}
-      {{- end -}}
-    {{- else -}}
-      {{- $authorName = . -}}
-    {{- end -}}
-  {{- end -}}
+  {{- $authorName := partial "author.html" .Site.Params.author -}}
   <title>
     {{ if (eq .Site.Params.reversepagetitle true) }}
       {{ with .Title }}
diff --git a/layouts/partials/schema.html b/layouts/partials/schema.html
index aafc672..2900b09 100644
--- a/layouts/partials/schema.html
+++ b/layouts/partials/schema.html
@@ -15,16 +15,7 @@
     }
   </script>
 {{ else if .IsPage }}
-  {{- $author := "" -}}
-  {{- with or (.Params.author) (.Site.Params.author) -}}
-    {{- if reflect.IsMap . -}}
-      {{- with .name -}}
-        {{- $author = . -}}
-      {{- end -}}
-    {{- else -}}
-      {{- $author = . -}}
-    {{- end -}}
-  {{- end -}}
+  {{- $author := partial "author.html" (or (.Params.author) (.Site.Params.author)) -}}
   {{ $favicon := .Site.Params.favicon | absURL }}
   <script type="application/ld+json">
     {

--
Gitblit v1.10.0