feat: filter by author in Pages and Featured widgets

To use, just set an `author` filter to a username in instances of the Pages or Featured widget:

```
[content.filters]
    tag = ""
    category = ""
    publication_type = ""
    author = "admin"
```

Close #1422
This commit is contained in:
George Cushen committed 2020-03-06 19:51:04 +00:00
1 parent 2dec2f91dc
commit 90aca0659c
6 files changed
+12

No files matched your search

+1
View File
@@ -29,6 +29,7 @@ subtitle = ""
tag = ""
category = ""
publication_type = ""
author = ""
[design]
# Toggle between the various page layout types.
+1
View File
@@ -28,6 +28,7 @@ subtitle = ""
tag = ""
category = ""
publication_type = ""
author = ""
exclude_featured = false
[design]
+1
View File
@@ -28,6 +28,7 @@ subtitle = ""
tag = ""
category = ""
publication_type = ""
author = ""
exclude_featured = false
[design]
+1
View File
@@ -28,6 +28,7 @@ subtitle = ""
tag = ""
category = ""
publication_type = ""
author = ""
exclude_featured = false
exclude_past = false
exclude_future = false
+4
View File
@@ -24,6 +24,10 @@
{{ $archive_page := site.GetPage (printf "publication_types/%s" $st.Params.content.filters.publication_type) }}
{{ $query = $query | intersect $archive_page.Pages }}
{{ end }}
{{ if $st.Params.content.filters.author }}
{{ $archive_page = site.GetPage (printf "authors/%s" (urlize $st.Params.content.filters.author)) }}
{{ $query = $query | intersect $archive_page.Pages }}
{{ end }}
{{/* Sort */}}
{{ $sort_by := "Date" }}
+4
View File
@@ -30,6 +30,10 @@
{{ $archive_page = site.GetPage (printf "publication_types/%s" $st.Params.content.filters.publication_type) }}
{{ $query = $query | intersect $archive_page.Pages }}
{{ end }}
{{ if $st.Params.content.filters.author }}
{{ $archive_page = site.GetPage (printf "authors/%s" (urlize $st.Params.content.filters.author)) }}
{{ $query = $query | intersect $archive_page.Pages }}
{{ end }}
{{ if $st.Params.content.filters.exclude_featured }}
{{ $query = where $query "Params.featured" "!=" true }}
{{ end }}