Skip to content

Commit a3c9b8d

Browse files
content container as dedicated partial; reuse as decorator
1 parent 6d7c7d2 commit a3c9b8d

4 files changed

Lines changed: 14 additions & 21 deletions

File tree

layouts/_default/section.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{{ define "main" }}
22
<section class="section content-padding">
3-
<div class="content-container">
4-
{{ partial "breadcrumbs.html" . }}
5-
<h1>{{ .Title }}</h1>
6-
{{ if .Params.Subtitle }}
7-
<h5 class="subtitle">{{ .Params.Subtitle }}</h5>
8-
{{ end }}
3+
{{ with partial "_decorators/content-container.html" . }}
94
{{ if .Content }}
105
{{ .Content }}
116
{{ end }}
@@ -20,7 +15,7 @@ <h5 class="subtitle">{{ .Params.Subtitle }}</h5>
2015
</ul>
2116
</div>
2217
{{ end }}
23-
</div>
18+
{{ end }}
2419
{{ if .Content }}
2520
{{ partial "shortcuts.html" . }}
2621
{{ end }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div class="content-container">
2+
{{ partial "breadcrumbs.html" . }}
3+
<h1>{{ .Title }}</h1>
4+
{{ if .Params.Subtitle }}
5+
<h5 class="subtitle">{{ .Params.Subtitle }}</h5>
6+
{{ end }}
7+
{{- inner . -}}
8+
</div>

layouts/partials/posts/post.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{{- $featuredImage := .Resources.GetMatch "featuredImage" -}}
22
<section class="post content-padding">
3-
<div class="content-container">
4-
{{ partial "breadcrumbs.html" . }}
5-
<h1>{{ .Title }}</h1>
6-
{{ if .Params.Subtitle }}
7-
<h5 class="subtitle">{{ .Params.Subtitle }}</h5>
8-
{{ end }}
3+
{{ with partial "_decorators/content-container.html" . }}
94
<div class="post-meta">{{ partial "posts/meta.html" . }}</div>
105
<div class="post-content">
116
{{ with $featuredImage }}
@@ -18,6 +13,6 @@ <h5 class="subtitle">{{ .Params.Subtitle }}</h5>
1813
{{ .Content }}
1914
{{ partial "posts/comments.html" .}}
2015
</div>
21-
</div>
16+
{{ end }}
2217
{{ partial "shortcuts.html" . }}
2318
</section>

layouts/partials/section/section.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<section class="content-padding">
2-
<div class="content-container">
3-
{{ partial "breadcrumbs.html" . }}
4-
<h1>{{ .Title }}</h1>
5-
{{ if .Params.Subtitle }}
6-
<h5 class="subtitle">{{ .Params.Subtitle }}</h5>
7-
{{ end }}
2+
{{ with partial "_decorators/content-container.html" . }}
83
{{ if .Content }}
94
{{ .Content }}
105
{{ else }}
@@ -25,7 +20,7 @@ <h5 class="subtitle">{{ .Params.Subtitle }}</h5>
2520
</div>
2621
{{ end }}
2722
{{ end }}
28-
</div>
23+
{{ end }}
2924
<div id="shortcuts-container">
3025
<div id="shortcuts">
3126
<div id="shortcuts-header"><i class="fa-solid fa-list"></i> On this page</div>

0 commit comments

Comments
 (0)