From 3dcd9912208fb764fd61791b06af5ee55db21580 Mon Sep 17 00:00:00 2001
From: Ramiro Morales <ramiro@users.noreply.github.com>
Date: Mon, 24 Nov 2025 22:31:05 +0000
Subject: [PATCH] fix(theme): center post body horizontally if there is no toc nor related blocks (#784)

---
 layouts/_default/single.html |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 7bb3f16..410b196 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -4,9 +4,11 @@
 {{ end }}
 
 {{ define "main" }}
+  {{- $related_content := .RegularPages.Related . -}}
+  {{- $needs_aside := or .Params.toc $related_content -}}
   {{ $page := .}}
   {{ $section := .Site.GetPage "section" .Section }}
-  <article class="flex-l mw8 center ph3 flex-wrap justify-between">
+  <article class="flex-l {{ if $needs_aside }}mw8{{ else }}mw7{{ end }} center ph3 flex-wrap justify-between">
     <header class="mt4 w-100">
       <aside class="instapaper_ignoref b helvetica tracked ttu">
           {{/*
@@ -56,7 +58,7 @@
         <span class="f6 mv4 dib tracked"> - {{ lang.Translate "wordCount" .WordCount }} </span>
       {{ end }}
     </header>
-    <div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes"  | compare.Default "serif"}} f4 nested-links {{ $.Param "text_color" | compare.Default "mid-gray" }} {{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "pl4-l" "pr4-l" }} w-two-thirds-l">
+    <div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes"  | compare.Default "serif"}} f4 nested-links {{ $.Param "text_color" | compare.Default "mid-gray" }} {{ compare.Conditional (compare.Eq $.Site.Language.LanguageDirection "rtl") "pl4-l" "pr4-l" }} {{ if $needs_aside }}w-two-thirds-l{{ else }}w-100-l{{ end }}">
       {{- .Content -}}
       {{- partials.Include "tags.html" . -}}
       <div class="mt6 instapaper_ignoref">
@@ -68,10 +70,11 @@
       {{ end }}
       </div>
     </div>
-
+    {{- if $needs_aside -}}
     <aside class="w-30-l mt6-l">
       {{- partials.Include "menu-contextual.html" . -}}
     </aside>
+    {{- end -}}
 
   </article>
 {{ end }}

--
Gitblit v1.10.0