From 70a31616f8efa472c3e16f6d6d6809bbca80ad96 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 11 Sep 2017 20:55:50 +0100 Subject: [PATCH] Sort blog posts by date --- layouts/posts/list.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 layouts/posts/list.html diff --git a/layouts/posts/list.html b/layouts/posts/list.html new file mode 100644 index 0000000..c1b932f --- /dev/null +++ b/layouts/posts/list.html @@ -0,0 +1,20 @@ +{{ partial "page_start.html" . }} +
+ {{ partial "content.html" . }} + {{ if ne .Params.hide_pages "true" }} +
+ {{ $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 }} +
+ {{ end }} +
+{{ partial "page_end.html" . }}