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" -}} | ||||
| {{- $showChildren := .Param "showChildArticles" -}} | ||||
| {{- $children := slice -}} | ||||
| {{- if $showChildren -}} | ||||
|   {{- $children = .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}} | ||||
| {{- end -}} | ||||
| 
 | ||||
| <div class="row"> | ||||
|   {{- $mainwidth := or (and .Params.noSidebar "12") "8" -}} | ||||
|  | @ -24,6 +29,11 @@ | |||
|       {{ with .Content -}} | ||||
|       <div class="post-content card-body" itemprop="articleBody">{{ . }}</div> | ||||
|       {{- end }} | ||||
|       {{- if eq $showChildren "embed" -}} | ||||
|         {{ range sort (sort $children "Date" "desc") "Weight" }} | ||||
| 	      {{ partial "embed" . }} | ||||
|         {{ end }} | ||||
| 	  {{- end -}} | ||||
|     </article> | ||||
|   </div> | ||||
|   {{ if not .Params.noSidebar -}} | ||||
|  | @ -31,16 +41,10 @@ | |||
|   {{- end }} | ||||
| </div> | ||||
| 
 | ||||
| {{- $showChildren := .Param "showChildArticles" -}} | ||||
| {{ if $showChildren -}} | ||||
| {{- if eq $showChildren "cards" -}} | ||||
| <div class="row"> | ||||
|   {{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}} | ||||
|   {{ range sort (sort $related "Date" "desc") "Weight" }} | ||||
|     {{- if eq $showChildren "cards" -}} | ||||
|   {{ range sort (sort $children "Date" "desc") "Weight" }} | ||||
|     {{ partial "card.html" . }} | ||||
| 	{{- else -}} | ||||
| 	{{ partial $showChildren . }} | ||||
| 	{{- end -}} | ||||
|   {{ end }} | ||||
| </div> | ||||
| {{- end }} | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue