From fa21ca7a0fe91e2de1d41aa56e12840f0a2d7683 Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Date: Sun, 8 Oct 2023 11:54:46 -0400
Subject: [PATCH] Moved article headers out into its own partial

---
 layouts/_default/list.html               | 30 +-----------------------
 layouts/_default/single.html             | 26 +-------------------
 layouts/entry/single.html                | 26 +-------------------
 layouts/news/list.html                   | 30 +-----------------------
 layouts/news/single.html                 | 26 +-------------------
 layouts/partials/post_header_list.html   |  7 ++++++
 layouts/partials/post_header_single.html |  3 +++
 layouts/partials/post_subheader.html     | 23 ++++++++++++++++++
 layouts/projects/list.html               | 30 +-----------------------
 layouts/projects/single.html             | 26 +-------------------
 layouts/resource/list.html               | 30 +-----------------------
 layouts/resource/single.html             | 26 +-------------------
 layouts/taxonomy/tag.html                | 30 +-----------------------
 13 files changed, 43 insertions(+), 270 deletions(-)
 create mode 100644 layouts/partials/post_header_list.html
 create mode 100644 layouts/partials/post_header_single.html
 create mode 100644 layouts/partials/post_subheader.html

diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 00a055046..90505f7e2 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -7,35 +7,7 @@
 {{ range $index, $element := $paginator.Pages }}
 
 <article class='post'>
-  <header class='post-header'>
-    <h2 class='post-title'>
-      <a href="{{ .Permalink }}">{{ .Title}}</a>
-      {{ if .Params.link }} &mdash; <a href="{{.Params.link}}">🔗</a>{{end}}
-    </h2>
-    <section class='post-meta text-muted'>
-      <ul class='list-inline'>
-        <li>
-          <i class='fa fa-calendar'></i>
-          <time class='post-date' datetime='{{  .Date.Format "2020-09-10" }}'> {{  .Date.Format "January 2 2006" }} </time>
-        </li>
-        <li>
-          <a class='fa-solid fa-book-open' href='{{ .Permalink }}'>
-            <span class='hidden'>Book icon</span>
-          </a>
-          <a href='{{ .Permalink }}'>Reading time: {{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end }}</a>
-        </li>
-        <li>
-          <i class='fa fa-folder-open'></i>
-          {{ $tags := .Params.tags}}
-          {{ with $tags }}
-            {{ range . }}
-              <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
-            {{ end }}
-          {{ end }}
-        </li>
-      </ul>
-    </section>
-  </header>
+  {{ partial "post_header_list.html" . }}
   <section class='post-content'>
     {{.Content }}
   </section>
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 5006d2921..74cb360ab 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -2,31 +2,7 @@
 <div class='row'>
   <div class='col-md-8'>
     <article class='post'>
-      <header class='post-header'>
-        <section class='post-meta text-muted'>
-          <ul class='list-inline'>
-            <li>
-              <i class='fa fa-calendar'></i>
-              <time class='post-date' datetime='{{  .Date.Format "2020-09-10" }}'> {{  .Date.Format "January 2 2006" }} </time>
-            </li>
-            <li>
-              <a class='fa-solid fa-book-open' href='{{ .Permalink }}'>
-                <span class='hidden'>Book icon</span>
-              </a>
-              <a href='{{ .Permalink }}'>Reading time: {{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end }}</a>
-            </li>
-            <li>
-              <i class='fa fa-folder-open'></i>
-              {{ $tags := .Params.tags}}
-              {{ with $tags }}
-                {{ range . }}
-                  <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
-                {{ end }}
-              {{ end }}
-            </li>
-          </ul>
-        </section>
-      </header>
+      {{ partial "post_header_single.html" . }}
       <section class='post-content'>
         {{ if isset .Params "toc" }}{{ .TableOfContents }}{{ end}}
         {{ .Content }}
diff --git a/layouts/entry/single.html b/layouts/entry/single.html
index 2cca77757..b3d308d1e 100644
--- a/layouts/entry/single.html
+++ b/layouts/entry/single.html
@@ -3,31 +3,7 @@
 <div class='row'>
   <div class='col-md-8'>
     <article class='post'>
-      <header class='post-header'>
-        <section class='post-meta text-muted'>
-          <ul class='list-inline'>
-            <li>
-              <i class='fa fa-calendar'></i>
-              <time class='post-date' datetime='{{  .Date.Format "2020-09-10" }}'> {{  .Date.Format "January 2 2006" }} </time>
-            </li>
-            <li>
-              <a class='fa-solid fa-book-open' href='{{ .Permalink }}'>
-                <span class='hidden'>Book icon</span>
-              </a>
-              <a href='{{ .Permalink }}'>Reading time: {{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end }}</a>
-            </li>
-            <li>
-              <i class='fa fa-folder-open'></i>
-              {{ $tags := .Params.tags}}
-              {{ with $tags }}
-                {{ range . }}
-                  <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
-                {{ end }}
-              {{ end }}
-            </li>
-          </ul>
-        </section>
-      </header>
+      {{ partial "post_header_single.html" . }}
       <section class='post-content'>
         {{ if isset .Params "toc" }}{{ .TableOfContents }}{{ end}}
         {{ .Content }}
diff --git a/layouts/news/list.html b/layouts/news/list.html
index de0b3b753..5776753b2 100644
--- a/layouts/news/list.html
+++ b/layouts/news/list.html
@@ -7,35 +7,7 @@
 {{ range $index, $element := $paginator.Pages }}
 
 <article class='post'>
-  <header class='post-header'>
-    <h2 class='post-title'>
-      <a href="{{ .Permalink }}">{{ .Title}}</a>
-      {{ if .Params.link }} &mdash; <a href="{{.Params.link}}">🔗</a>{{end}}
-    </h2>
-    <section class='post-meta text-muted'>
-      <ul class='list-inline'>
-        <li>
-          <i class='fa fa-calendar'></i>
-          <time class='post-date' datetime='{{  .Date.Format "2020-09-10" }}'> {{  .Date.Format "January 2 2006" }} </time>
-        </li>
-        <li>
-          <a class='fa-solid fa-book-open' href='{{ .Permalink }}'>
-            <span class='hidden'>Book icon</span>
-          </a>
-          <a href='{{ .Permalink }}'>Reading time: {{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end }}</a>
-        </li>
-        <li>
-          <i class='fa fa-folder-open'></i>
-          {{ $tags := .Params.tags}}
-          {{ with $tags }}
-            {{ range . }}
-              <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
-            {{ end }}
-          {{ end }}
-        </li>
-      </ul>
-    </section>
-  </header>
+  {{ partial "post_header_list.html" . }}
   <section class='post-content'>
     {{.Content }}
   </section>
diff --git a/layouts/news/single.html b/layouts/news/single.html
index 70ecde8b2..83b1f4fa2 100644
--- a/layouts/news/single.html
+++ b/layouts/news/single.html
@@ -2,31 +2,7 @@
 <div class='row'>
   <div class='col-md-8'>
     <article class='post'>
-      <header class='post-header'>
-        <section class='post-meta text-muted'>
-          <ul class='list-inline'>
-            <li>
-              <i class='fa fa-calendar'></i>
-              <time class='post-date' datetime='{{  .Date.Format "2020-09-10" }}'> {{  .Date.Format "January 2 2006" }} </time>
-            </li>
-            <li>
-              <a class='fa-solid fa-book-open' href='{{ .Permalink }}'>
-                <span class='hidden'>Book icon</span>
-              </a>
-              <a href='{{ .Permalink }}'>Reading time: {{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end }}</a>
-            </li>
-            <li>
-              <i class='fa fa-folder-open'></i>
-              {{ $tags := .Params.tags}}
-              {{ with $tags }}
-                {{ range . }}
-                  <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
-                {{ end }}
-              {{ end }}
-            </li>
-          </ul>
-        </section>
-      </header>
+      {{ partial "post_header_single.html" . }}
       <section class='post-content'>
         {{ if isset .Params "toc" }}{{ .TableOfContents }}{{ end}}
         {{ .Content }}
diff --git a/layouts/partials/post_header_list.html b/layouts/partials/post_header_list.html
new file mode 100644
index 000000000..d8ac98b79
--- /dev/null
+++ b/layouts/partials/post_header_list.html
@@ -0,0 +1,7 @@
+<header class='post-header'>
+  <h2 class='post-title'>
+    <a href="{{ .Permalink }}">{{ .Title}}</a>
+    {{ if .Params.link }} &mdash; <a href="{{.Params.link}}">🔗</a>{{end}}
+  </h2>
+  {{ partial "post_subheader.html" . }}
+</header>
diff --git a/layouts/partials/post_header_single.html b/layouts/partials/post_header_single.html
new file mode 100644
index 000000000..9db761a89
--- /dev/null
+++ b/layouts/partials/post_header_single.html
@@ -0,0 +1,3 @@
+<header class='post-header'>
+  {{ partial "post_subheader.html" . }}
+</header>
diff --git a/layouts/partials/post_subheader.html b/layouts/partials/post_subheader.html
new file mode 100644
index 000000000..e4fa69032
--- /dev/null
+++ b/layouts/partials/post_subheader.html
@@ -0,0 +1,23 @@
+<section class='post-meta text-muted'>
+  <ul class='list-inline'>
+    <li>
+      <i class='fa fa-calendar'></i>
+      <time class='post-date' datetime='{{  .Date.Format "2020-09-10" }}'> {{  .Date.Format "January 2 2006" }} </time>
+    </li>
+    <li>
+      <a class='fa-solid fa-book-open' href='{{ .Permalink }}'>
+        <span class='hidden'>Book icon</span>
+      </a>
+      <a href='{{ .Permalink }}'>Reading time: {{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end }}</a>
+    </li>
+    <li>
+      <i class='fa fa-folder-open'></i>
+      {{ $tags := .Params.tags}}
+      {{ with $tags }}
+        {{ range . }}
+          <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
+        {{ end }}
+      {{ end }}
+    </li>
+  </ul>
+</section>
diff --git a/layouts/projects/list.html b/layouts/projects/list.html
index 686e7faae..46577b7b4 100644
--- a/layouts/projects/list.html
+++ b/layouts/projects/list.html
@@ -7,35 +7,7 @@
 {{ range $index, $element := $paginator.Pages }}
 
 <article class='post'>
-  <header class='post-header'>
-    <h2 class='post-title'>
-      <a href="{{ .Permalink }}">{{ .Title}}</a>
-      {{ if .Params.link }} &mdash; <a href="{{.Params.link}}">🔗</a>{{end}}
-    </h2>
-    <section class='post-meta text-muted'>
-      <ul class='list-inline'>
-        <li>
-          <i class='fa fa-calendar'></i>
-          <time class='post-date' datetime='{{  .Date.Format "2020-09-10" }}'> {{  .Date.Format "January 2 2006" }} </time>
-        </li>
-        <li>
-          <a class='fa-solid fa-book-open' href='{{ .Permalink }}'>
-            <span class='hidden'>Book icon</span>
-          </a>
-          <a href='{{ .Permalink }}'>Reading time: {{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end }}</a>
-        </li>
-        <li>
-          <i class='fa fa-folder-open'></i>
-          {{ $tags := .Params.tags}}
-          {{ with $tags }}
-            {{ range . }}
-              <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
-            {{ end }}
-          {{ end }}
-        </li>
-      </ul>
-    </section>
-  </header>
+  {{ partial "post_header_list.html" . }}
   <section class='post-content'>
     {{.Content }}
   </section>
diff --git a/layouts/projects/single.html b/layouts/projects/single.html
index 57bc84a0b..8f085ba04 100644
--- a/layouts/projects/single.html
+++ b/layouts/projects/single.html
@@ -2,31 +2,7 @@
 <div class='row'>
   <div class='col-md-8'>
     <article class='post'>
-      <header class='post-header'>
-        <section class='post-meta text-muted'>
-          <ul class='list-inline'>
-            <li>
-              <i class='fa fa-calendar'></i>
-              <time class='post-date' datetime='{{  .Date.Format "2020-09-10" }}'> {{  .Date.Format "January 2 2006" }} </time>
-            </li>
-            <li>
-              <a class='fa-solid fa-book-open' href='{{ .Permalink }}'>
-                <span class='hidden'>Book icon</span>
-              </a>
-              <a href='{{ .Permalink }}'>Reading time: {{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end }}</a>
-            </li>
-            <li>
-              <i class='fa fa-folder-open'></i>
-              {{ $tags := .Params.tags}}
-              {{ with $tags }}
-                {{ range . }}
-                  <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
-                {{ end }}
-              {{ end }}
-            </li>
-          </ul>
-        </section>
-      </header>
+      {{ partial "post_header_single.html" . }}
       <section class='post-content'>
         {{ .Content }}
 
diff --git a/layouts/resource/list.html b/layouts/resource/list.html
index 7ab135e1c..7f25cb960 100644
--- a/layouts/resource/list.html
+++ b/layouts/resource/list.html
@@ -7,35 +7,7 @@
 {{ range $index, $element := $paginator.Pages }}
 
 <article class='post'>
-  <header class='post-header'>
-    <h2 class='post-title'>
-      <a href="{{ .Permalink }}">{{ .Title}}</a>
-      {{ if .Params.link }} &mdash; <a href="{{.Params.link}}">🔗</a>{{end}}
-    </h2>
-    <section class='post-meta text-muted'>
-      <ul class='list-inline'>
-        <li>
-          <i class='fa fa-calendar'></i>
-          <time class='post-date' datetime='{{  .Date.Format "2020-09-10" }}'> {{  .Date.Format "January 2 2006" }} </time>
-        </li>
-        <li>
-          <a class='fa-solid fa-book-open' href='{{ .Permalink }}'>
-            <span class='hidden'>Book icon</span>
-          </a>
-          <a href='{{ .Permalink }}'>Reading time: {{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end }}</a>
-        </li>
-        <li>
-          <i class='fa fa-folder-open'></i>
-          {{ $tags := .Params.tags}}
-          {{ with $tags }}
-            {{ range . }}
-              <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
-            {{ end }}
-          {{ end }}
-        </li>
-      </ul>
-    </section>
-  </header>
+  {{ partial "post_header_list.html" . }}
   <section class='post-content'>
     {{.Content }}
   </section>
diff --git a/layouts/resource/single.html b/layouts/resource/single.html
index 3d92db957..79d99931f 100644
--- a/layouts/resource/single.html
+++ b/layouts/resource/single.html
@@ -2,31 +2,7 @@
 <div class='row'>
   <div class='col-md-8'>
     <article class='post'>
-      <header class='post-header'>
-        <section class='post-meta text-muted'>
-          <ul class='list-inline'>
-            <li>
-              <i class='fa fa-calendar'></i>
-              <time class='post-date' datetime='{{  .Date.Format "2020-09-10" }}'> {{  .Date.Format "January 2 2006" }} </time>
-            </li>
-            <li>
-              <a class='fa-solid fa-book-open' href='{{ .Permalink }}'>
-                <span class='hidden'>Book icon</span>
-              </a>
-              <a href='{{ .Permalink }}'>Reading time: {{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end }}</a>
-            </li>
-            <li>
-              <i class='fa fa-folder-open'></i>
-              {{ $tags := .Params.tags}}
-              {{ with $tags }}
-                {{ range . }}
-                  <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
-                {{ end }}
-              {{ end }}
-            </li>
-          </ul>
-        </section>
-      </header>
+      {{ partial "post_header_single.html" . }}
       <section class='post-content'>
         {{ if isset .Params "toc" }}{{ .TableOfContents }}{{ end}}
         {{ .Content }}
diff --git a/layouts/taxonomy/tag.html b/layouts/taxonomy/tag.html
index 957f1f86d..d7a22a8f8 100644
--- a/layouts/taxonomy/tag.html
+++ b/layouts/taxonomy/tag.html
@@ -7,35 +7,7 @@
  {{ range $index, $element := $paginator.Pages }}
 
  <article class='post'>
-   <header class='post-header'>
-     <h2 class='post-title'>
-       <a href="{{ .Permalink }}">{{ .Title}}</a>
-       {{ if .Params.link }} &mdash; <a href="{{.Params.link}}">🔗</a>{{end}}
-     </h2>
-     <section class='post-meta text-muted'>
-       <ul class='list-inline'>
-         <li>
-           <i class='fa fa-calendar'></i>
-           <time class='post-date' datetime='{{  .Date.Format "2020-09-10" }}'> {{  .Date.Format "January 2 2006" }} </time>
-         </li>
-         <li>
-           <a class='fa-solid fa-book-open' href='{{ .Permalink }}'>
-             <span class='hidden'>Book icon</span>
-           </a>
-           <a href='{{ .Permalink }}'>Reading time: {{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end }}</a>
-         </li>
-         <li>
-           <i class='fa fa-folder-open'></i>
-           {{ $tags := .Params.tags}}
-           {{ with $tags }}
-             {{ range . }}
-               <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
-             {{ end }}
-           {{ end }}
-         </li>
-       </ul>
-     </section>
-   </header>
+   {{ partial "post_header_list.html" . }}
    <section class='post-content'>
      {{.Content }}
    </section>
-- 
GitLab