From eaccab614eb819c4530a12b9570901ded27ead58 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Thu, 16 Nov 2017 22:30:52 +0000 Subject: [PATCH] publication widget: Add option to exclude selected publications Add `exclude_selected = false` option to frontmatter of publication widget. See #385 --- exampleSite/content/home/publications.md | 3 +++ layouts/partials/widgets/publications.html | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/exampleSite/content/home/publications.md b/exampleSite/content/home/publications.md index b0ed0f0f..b7487933 100644 --- a/exampleSite/content/home/publications.md +++ b/exampleSite/content/home/publications.md @@ -31,5 +31,8 @@ list_format = 3 # 5: Book # 6: Book chapter publication_type = "-1" + +# Exclude publications that are shown in the Selected Publications widget? +exclude_selected = false +++ diff --git a/layouts/partials/widgets/publications.html b/layouts/partials/widgets/publications.html index d2823b76..6cc0d606 100644 --- a/layouts/partials/widgets/publications.html +++ b/layouts/partials/widgets/publications.html @@ -25,6 +25,10 @@ {{ $.Scratch.Set "recent_pubs" (where $.Site.RegularPages "Type" "publication") }} {{ end }} + {{ if $page.Params.exclude_selected }} + {{ $.Scratch.Set "recent_pubs" ( ($.Scratch.Get "recent_pubs") | intersect (where (where $.Site.RegularPages "Type" "publication") ".Params.selected" "!=" true) ) }} + {{ end }} + {{ $recent_pubs := $.Scratch.Get "recent_pubs" }} {{ range first $page.Params.count $recent_pubs }} {{ if eq $page.Params.list_format 1 }}