allow embedding of child articles via showChildArticles site or page parameter
This commit is contained in:
parent
8839ff3cad
commit
d2d1c29e2d
1 changed files with 12 additions and 8 deletions
|
@ -1,4 +1,9 @@
|
||||||
{{ define "main" -}}
|
{{ define "main" -}}
|
||||||
|
{{- $showChildren := .Param "showChildArticles" -}}
|
||||||
|
{{- $children := slice -}}
|
||||||
|
{{- if $showChildren -}}
|
||||||
|
{{- $children = .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{- $mainwidth := or (and .Params.noSidebar "12") "8" -}}
|
{{- $mainwidth := or (and .Params.noSidebar "12") "8" -}}
|
||||||
|
@ -24,6 +29,11 @@
|
||||||
{{ with .Content -}}
|
{{ with .Content -}}
|
||||||
<div class="post-content card-body" itemprop="articleBody">{{ . }}</div>
|
<div class="post-content card-body" itemprop="articleBody">{{ . }}</div>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if eq $showChildren "embed" -}}
|
||||||
|
{{ range sort (sort $children "Date" "desc") "Weight" }}
|
||||||
|
{{ partial "embed" . }}
|
||||||
|
{{ end }}
|
||||||
|
{{- end -}}
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
{{ if not .Params.noSidebar -}}
|
{{ if not .Params.noSidebar -}}
|
||||||
|
@ -31,16 +41,10 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{- $showChildren := .Param "showChildArticles" -}}
|
{{- if eq $showChildren "cards" -}}
|
||||||
{{ if $showChildren -}}
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}}
|
{{ range sort (sort $children "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 }}
|
||||||
|
|
Loading…
Add table
Reference in a new issue