From e5d932477c0d9797163e11f81a75b896b9f60c58 Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Date: Sun, 8 Oct 2023 12:18:18 -0400
Subject: [PATCH] Split out single page into partials

---
 layouts/_default/single.html      | 17 +----------------
 layouts/entry/single.html         | 17 +----------------
 layouts/news/single.html          | 17 +----------------
 layouts/partials/body_single.html | 16 ++++++++++++++++
 layouts/projects/single.html      | 17 +----------------
 5 files changed, 20 insertions(+), 64 deletions(-)
 create mode 100644 layouts/partials/body_single.html

diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 02d8b299f..709763526 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,18 +1,3 @@
 {{ partial "top_single.html" . }}
-<div class='row'>
-  <div class='col-md-8'>
-    <article class='post'>
-      {{ partial "post_header_single.html" . }}
-      <section class='post-content'>
-        {{ if isset .Params "toc" }}{{ .TableOfContents }}{{ end}}
-        {{ .Content }}
-
-        {{ partial "article_footer.html" . }}
-        {{ partial "article_share.html" . }}
-        {{ partial "comments.html" . }}
-      </section>
-    </article>
-  </div>
-  {{ partial "side_menu_single.html" . }}
-</div>
+{{ partial "body_single.html" . }}
 {{ partial "bottom_single.html" . }}
diff --git a/layouts/entry/single.html b/layouts/entry/single.html
index e4f6a6b49..709763526 100644
--- a/layouts/entry/single.html
+++ b/layouts/entry/single.html
@@ -1,18 +1,3 @@
 {{ partial "top_single.html" . }}
-<div class='row'>
-  <div class='col-md-8'>
-    <article class='post'>
-      {{ partial "post_header_single.html" . }}
-      <section class='post-content'>
-        {{ if isset .Params "toc" }}{{ .TableOfContents }}{{ end}}
-        {{ .Content }}
-        {{ partial "backlinks.html" . }}
-        {{ partial "article_footer.html" . }}
-        {{ partial "article_share.html" . }}
-        {{ partial "comments.html" . }}
-      </section>
-    </article>
-  </div>
-  {{ partial "side_menu_single.html" . }}
-</div>
+{{ partial "body_single.html" . }}
 {{ partial "bottom_single.html" . }}
diff --git a/layouts/news/single.html b/layouts/news/single.html
index ddd8f71ca..709763526 100644
--- a/layouts/news/single.html
+++ b/layouts/news/single.html
@@ -1,18 +1,3 @@
 {{ partial "top_single.html" . }}
-<div class='row'>
-  <div class='col-md-8'>
-    <article class='post'>
-      {{ partial "post_header_single.html" . }}
-      <section class='post-content'>
-        {{ if isset .Params "toc" }}{{ .TableOfContents }}{{ end}}
-        {{ .Content }}
-        
-        {{ partial "article_footer.html" . }}
-        {{ partial "article_share.html" . }}
-        {{ partial "comments.html" . }}
-      </section>
-    </article>
-  </div>
-  {{ partial "side_menu_single.html" . }}
-</div>
+{{ partial "body_single.html" . }}
 {{ partial "bottom_single.html" . }}
diff --git a/layouts/partials/body_single.html b/layouts/partials/body_single.html
new file mode 100644
index 000000000..9c8d39d96
--- /dev/null
+++ b/layouts/partials/body_single.html
@@ -0,0 +1,16 @@
+<div class='row'>
+  <div class='col-md-8'>
+    <article class='post'>
+      {{ partial "post_header_single.html" . }}
+      <section class='post-content'>
+        {{ if isset .Params "toc" }}{{ .TableOfContents }}{{ end}}
+        {{ .Content }}
+        {{ if eq .Section "resource" }}{{ partial "backlinks.html" . }}{{ end }}
+        {{ partial "article_footer.html" . }}
+        {{ partial "article_share.html" . }}
+        {{ partial "comments.html" . }}
+      </section>
+    </article>
+  </div>
+  {{ partial "side_menu_single.html" . }}
+</div>
diff --git a/layouts/projects/single.html b/layouts/projects/single.html
index ddd8f71ca..709763526 100644
--- a/layouts/projects/single.html
+++ b/layouts/projects/single.html
@@ -1,18 +1,3 @@
 {{ partial "top_single.html" . }}
-<div class='row'>
-  <div class='col-md-8'>
-    <article class='post'>
-      {{ partial "post_header_single.html" . }}
-      <section class='post-content'>
-        {{ if isset .Params "toc" }}{{ .TableOfContents }}{{ end}}
-        {{ .Content }}
-        
-        {{ partial "article_footer.html" . }}
-        {{ partial "article_share.html" . }}
-        {{ partial "comments.html" . }}
-      </section>
-    </article>
-  </div>
-  {{ partial "side_menu_single.html" . }}
-</div>
+{{ partial "body_single.html" . }}
 {{ partial "bottom_single.html" . }}
-- 
GitLab