From ed8f04ea2fe527fcc043c5f45929d39590eb1e56 Mon Sep 17 00:00:00 2001 From: Bertrand Thierry <5602767+Bertbk@users.noreply.github.com> Date: Wed, 27 Feb 2019 23:06:39 +0100 Subject: [PATCH] feat(widget): enable splitting Talks section into past and upcoming talks See #721 --- exampleSite/content/home/talks.md | 4 +++- layouts/partials/widgets/pages.html | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/exampleSite/content/home/talks.md b/exampleSite/content/home/talks.md index b653e575..eeed17d1 100644 --- a/exampleSite/content/home/talks.md +++ b/exampleSite/content/home/talks.md @@ -28,7 +28,9 @@ subtitle = "" category = "" publication_type = "" exclude_featured = false - + exclude_past = false + exclude_future = false + [design] # Toggle between the various page layout types. # 1 = List diff --git a/layouts/partials/widgets/pages.html b/layouts/partials/widgets/pages.html index 24ac12f0..78d2dc95 100644 --- a/layouts/partials/widgets/pages.html +++ b/layouts/partials/widgets/pages.html @@ -33,6 +33,12 @@ {{ if $st.Params.content.filters.exclude_featured }} {{ $query = where $query "Params.featured" "!=" true }} {{ end }} +{{ if $st.Params.content.filters.exclude_past }} + {{ $query = where $query "Date" "<=" now }} +{{ end }} +{{ if $st.Params.content.filters.exclude_future }} + {{ $query = where $query "Date" ">" now }} +{{ end }} {{/* Sort (use Hugo default for now) */}} {{/* $sort_by := "Date" */}}