control rendering of children via parameter showChildArticles
This commit is contained in:
parent
6a84403aff
commit
8839ff3cad
4 changed files with 15 additions and 9 deletions
|
@ -31,14 +31,19 @@
|
|||
{{- end }}
|
||||
</div>
|
||||
|
||||
{{ if eq .Site.Params.showChildArticles "cards" -}}
|
||||
{{- $showChildren := .Param "showChildArticles" -}}
|
||||
{{ if $showChildren -}}
|
||||
<div class="row">
|
||||
{{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}}
|
||||
{{ range sort (sort $related "Date" "desc") "Weight" }}
|
||||
{{- if eq $showChildren "cards" -}}
|
||||
{{ partial "card.html" . }}
|
||||
{{- else -}}
|
||||
{{ partial $showChildren . }}
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
|
|
@ -27,12 +27,7 @@
|
|||
|
||||
{{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}}
|
||||
{{ range sort (sort $related "Date" "desc") "Weight" }}
|
||||
<div class="card-body">
|
||||
<h3 class="post-title" itemprop="name headline">{{ .Title }}</h3>
|
||||
{{ with .Content -}}
|
||||
<div itemprop="articleBody">{{ . }}</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{ partial "embed" . }}
|
||||
{{ end }}
|
||||
|
||||
</article>
|
||||
|
|
7
layouts/partials/embed.html
Normal file
7
layouts/partials/embed.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<div class="card-body">
|
||||
<h3 class="post-title" itemprop="name headline">{{ .Title }}</h3>
|
||||
{{ with .Content -}}
|
||||
<div itemprop="articleBody">{{ . }}</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
{{- $pid := or (.Get "pid") (.Get "page") -}}
|
||||
{{- $this := $.Page -}}
|
||||
{{- $title := .Get "title" -}}
|
||||
{{- $noTitle := .Get "notitle" -}}
|
||||
{{- $linkid := or ($this.Scratch.Get "linkid") 1 -}}
|
||||
{{- $this.Scratch.Set "linkid" (add $linkid 1) -}}
|
||||
{{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}}
|
||||
|
|
Loading…
Add table
Reference in a new issue