Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Center post body horizontally if there is no toc nor related blocks #690

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
{{ end }}

{{ define "main" }}
{{- $related_content := .RegularPages.Related . -}}
{{- $needs_aside := or .Params.toc $related_content -}}
{{ $section := .Site.GetPage "section" .Section }}
<article class="flex-l flex-wrap justify-between mw8 center ph3">
<article class="flex-l flex-wrap justify-between {{ if $needs_aside }}mw8{{ else }}mw7{{ end }} center ph3">
<header class="mt4 w-100">
<aside class="instapaper_ignoref b helvetica tracked ttu">
{{/*
Expand Down Expand Up @@ -47,7 +49,7 @@ <h1 class="f1 athelas mt3 mb1">
<span class="f6 mv4 dib tracked"> - {{ i18n "wordCount" .WordCount }} </span>
{{ end }}
</header>
<div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes" | default "serif"}} f4 nested-links {{ $.Param "text_color" | default "mid-gray" }} {{ cond (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" | default "serif"}} f4 nested-links {{ $.Param "text_color" | default "mid-gray" }} {{ cond (eq $.Site.Language.LanguageDirection "rtl") "pl4-l" "pr4-l" }} {{ if $needs_aside }}w-two-thirds-l{{ else }}w-100-l{{ end }}">
{{- .Content -}}
{{- partial "tags.html" . -}}
<div class="mt6 instapaper_ignoref">
Expand All @@ -59,10 +61,11 @@ <h1 class="f1 athelas mt3 mb1">
{{ end }}
</div>
</div>

{{- if $needs_aside -}}
<aside class="w-30-l mt6-l">
{{- partial "menu-contextual.html" . -}}
</aside>
{{- end -}}

</article>
{{ end }}