move rendering of main content to new partial 'content'

This commit is contained in:
Helmut Merz 2023-10-26 19:38:52 +02:00
parent d2d1c29e2d
commit d8db1dbddf
3 changed files with 25 additions and 42 deletions

View file

@ -10,25 +10,7 @@
<div class="col-md-{{ $mainwidth }}">
<article class="card mt-3 mb-3"
itemscope itemtype="http://schema.org/BlogPosting">
{{ if .Title -}}
<header class="post-header card-header">
<h2 class="post-title" itemprop="name headline">{{ .Title }}</h2>
{{ if and (not .Params.nodate) .Date -}}
<p class="post-meta">
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'
itemprop="datePublished">{{ .Date.Format (i18n "dateFormat") }}</time>
{{ with .Params.Author -}} •
<span itemprop="author" itemscope
itemtype="http://schema.org/Person">
<span itemprop="name">{{ . }}</span></span>
{{- end }}
</p>
{{- end }}
</header>
{{- end }}
{{ with .Content -}}
<div class="post-content card-body" itemprop="articleBody">{{ . }}</div>
{{- end }}
{{- partial "content" . -}}
{{- if eq $showChildren "embed" -}}
{{ range sort (sort $children "Date" "desc") "Weight" }}
{{ partial "embed" . }}

View file

@ -5,28 +5,9 @@
<div class="col-md-{{ $mainwidth }}">
<article class="card mt-3 mb-3"
itemscope itemtype="http://schema.org/BlogPosting">
{{ if .Title -}}
<header class="post-header card-header">
<h2 class="post-title" itemprop="name headline">{{ .Title }}</h2>
{{ if and (not .Params.nodate) .Date -}}
<p class="post-meta">
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'
itemprop="datePublished">{{ .Date.Format (i18n "dateFormat") }}</time>
{{ with .Params.Author -}} •
<span itemprop="author" itemscope
itemtype="http://schema.org/Person">
<span itemprop="name">{{ . }}</span></span>
{{- end }}
</p>
{{- end }}
</header>
{{- end }}
{{ with .Content -}}
<div class="post-content card-body" itemprop="articleBody">{{ . }}</div>
{{- end }}
{{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}}
{{ range sort (sort $related "Date" "desc") "Weight" }}
{{- partial "content" . -}}
{{- $children := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}}
{{ range sort (sort $children "Date" "desc") "Weight" }}
{{ partial "embed" . }}
{{ end }}

View file

@ -0,0 +1,20 @@
{{ if .Title -}}
<header class="post-header card-header">
<h2 class="post-title" itemprop="name headline">{{ .Title }}</h2>
{{ if and (not .Params.nodate) .Date -}}
<p class="post-meta">
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'
itemprop="datePublished">{{ .Date.Format (i18n "dateFormat") }}</time>
{{ with .Params.Author -}} •
<span itemprop="author" itemscope
itemtype="http://schema.org/Person">
<span itemprop="name">{{ . }}</span></span>
{{- end }}
</p>
{{- end }}
</header>
{{- end }}
{{ with .Content -}}
<div class="post-content card-body" itemprop="articleBody">{{ . }}</div>
{{- end }}