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 }}
|
{{- end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ if eq .Site.Params.showChildArticles "cards" -}}
|
{{- $showChildren := .Param "showChildArticles" -}}
|
||||||
|
{{ if $showChildren -}}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}}
|
{{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}}
|
||||||
{{ range sort (sort $related "Date" "desc") "Weight" }}
|
{{ range sort (sort $related "Date" "desc") "Weight" }}
|
||||||
|
{{- if eq $showChildren "cards" -}}
|
||||||
{{ partial "card.html" . }}
|
{{ partial "card.html" . }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ partial $showChildren . }}
|
||||||
|
{{- end -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{- end }}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
|
@ -27,12 +27,7 @@
|
||||||
|
|
||||||
{{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}}
|
{{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}}
|
||||||
{{ range sort (sort $related "Date" "desc") "Weight" }}
|
{{ range sort (sort $related "Date" "desc") "Weight" }}
|
||||||
<div class="card-body">
|
{{ partial "embed" . }}
|
||||||
<h3 class="post-title" itemprop="name headline">{{ .Title }}</h3>
|
|
||||||
{{ with .Content -}}
|
|
||||||
<div itemprop="articleBody">{{ . }}</div>
|
|
||||||
{{- end }}
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
</article>
|
</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") -}}
|
{{- $pid := or (.Get "pid") (.Get "page") -}}
|
||||||
{{- $this := $.Page -}}
|
{{- $this := $.Page -}}
|
||||||
{{- $title := .Get "title" -}}
|
{{- $title := .Get "title" -}}
|
||||||
{{- $noTitle := .Get "notitle" -}}
|
|
||||||
{{- $linkid := or ($this.Scratch.Get "linkid") 1 -}}
|
{{- $linkid := or ($this.Scratch.Get "linkid") 1 -}}
|
||||||
{{- $this.Scratch.Set "linkid" (add $linkid 1) -}}
|
{{- $this.Scratch.Set "linkid" (add $linkid 1) -}}
|
||||||
{{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}}
|
{{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue