Customize ordering on list pages
This commit is contained in:
parent
600c813bfb
commit
a617ad961c
3 changed files with 4 additions and 21 deletions
|
@ -2,4 +2,6 @@
|
||||||
title: Blog
|
title: Blog
|
||||||
linktitle: Posts
|
linktitle: Posts
|
||||||
show_images: true
|
show_images: true
|
||||||
|
sort_by: Date
|
||||||
|
sort_order: desc
|
||||||
---
|
---
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
{{ if ne .Params.hide_pages "true" }}
|
{{ if ne .Params.hide_pages "true" }}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{ $parent := . }}
|
{{ $parent := . }}
|
||||||
{{ $valid_pages := where .Site.Pages.ByTitle ".Parent" "!=" nil }}
|
{{ $sorted_pages := sort .Site.Pages (default "Title" .Params.sort_by) (default "asc" .Params.sort_order)}}
|
||||||
|
{{ $valid_pages := where $sorted_pages ".Parent" "!=" nil }}
|
||||||
{{ $valid_pages := where $valid_pages ".Params.hide_in_list" "!=" "true" }}
|
{{ $valid_pages := where $valid_pages ".Params.hide_in_list" "!=" "true" }}
|
||||||
{{ range where $valid_pages ".Parent.UniqueID" $parent.UniqueID }}
|
{{ range where $valid_pages ".Parent.UniqueID" $parent.UniqueID }}
|
||||||
{{ if $parent.Params.show_images }}
|
{{ if $parent.Params.show_images }}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
{{ partial "page_start.html" . }}
|
|
||||||
<section id="main" class="container">
|
|
||||||
{{ partial "content.html" . }}
|
|
||||||
{{ if ne .Params.hide_pages "true" }}
|
|
||||||
<div class="row">
|
|
||||||
{{ $parent := . }}
|
|
||||||
{{ $valid_pages := sort .Site.Pages "Date" "desc" }}
|
|
||||||
{{ $valid_pages := where $valid_pages ".Parent" "!=" nil }}
|
|
||||||
{{ $valid_pages := where $valid_pages ".Params.hide_in_list" "!=" "true" }}
|
|
||||||
{{ range where $valid_pages ".Parent.UniqueID" $parent.UniqueID }}
|
|
||||||
{{ if $parent.Params.show_images }}
|
|
||||||
{{ partial "box_image.html" . }}
|
|
||||||
{{ else }}
|
|
||||||
{{ partial "box.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
|
||||||
{{ partial "page_end.html" . }}
|
|
Loading…
Reference in a new issue