mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-23 10:00:52 +02:00
Add sort_by support to people widget
This commit is contained in:
parent
6dc78be622
commit
e2f7c290fb
2 changed files with 9 additions and 0 deletions
|
@ -27,6 +27,13 @@
|
||||||
{{ range $block.Params.content.user_groups }}
|
{{ range $block.Params.content.user_groups }}
|
||||||
{{ $query := where (where site.Pages "Section" "authors") ".Params.user_groups" "intersect" (slice .) }}
|
{{ $query := where (where site.Pages "Section" "authors") ".Params.user_groups" "intersect" (slice .) }}
|
||||||
|
|
||||||
|
{{/* Sort */}}
|
||||||
|
{{ $sort_by := $block.Params.content.sort_by | default "Params.last_name" }}
|
||||||
|
{{ $sort_by = partial "blox-core/functions/get_sort_by_parameter" $sort_by }}
|
||||||
|
{{ $sort_ascending := $block.Params.content.sort_ascending | default true }}
|
||||||
|
{{ $sort_order := cond $sort_ascending "asc" "desc" }}
|
||||||
|
{{ $query = sort $query $sort_by $sort_order }}
|
||||||
|
|
||||||
{{if $query | and (gt (len $block.Params.content.user_groups) 1) }}
|
{{if $query | and (gt (len $block.Params.content.user_groups) 1) }}
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<h2 class="mb-4">{{ . | markdownify }}</h2>
|
<h2 class="mb-4">{{ . | markdownify }}</h2>
|
||||||
|
|
|
@ -17,6 +17,8 @@ content:
|
||||||
# Edit `user_groups` in each user's profile to add them to one or more of these groups.
|
# Edit `user_groups` in each user's profile to add them to one or more of these groups.
|
||||||
user_groups:
|
user_groups:
|
||||||
- Teachers
|
- Teachers
|
||||||
|
sort_by: Params.last_name
|
||||||
|
sort_ascending: true
|
||||||
design:
|
design:
|
||||||
show_interests: false
|
show_interests: false
|
||||||
show_role: true
|
show_role: true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue