mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 22:14:08 +00:00
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:
1 parent
2dec2f91dc
commit
90aca0659c
6 files changed
+12
No files matched your search
@@ -29,6 +29,7 @@ subtitle = ""
|
||||
tag = ""
|
||||
category = ""
|
||||
publication_type = ""
|
||||
author = ""
|
||||
|
||||
[design]
|
||||
# Toggle between the various page layout types.
|
||||
|
||||
@@ -28,6 +28,7 @@ subtitle = ""
|
||||
tag = ""
|
||||
category = ""
|
||||
publication_type = ""
|
||||
author = ""
|
||||
exclude_featured = false
|
||||
|
||||
[design]
|
||||
|
||||
@@ -28,6 +28,7 @@ subtitle = ""
|
||||
tag = ""
|
||||
category = ""
|
||||
publication_type = ""
|
||||
author = ""
|
||||
exclude_featured = false
|
||||
|
||||
[design]
|
||||
|
||||
@@ -28,6 +28,7 @@ subtitle = ""
|
||||
tag = ""
|
||||
category = ""
|
||||
publication_type = ""
|
||||
author = ""
|
||||
exclude_featured = false
|
||||
exclude_past = false
|
||||
exclude_future = false
|
||||
|
||||
@@ -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" }}
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
Reference in new issue
Block a user