fix: no users appear in People widget

Bug caused by search/replace during last People widget update in #1323 .

Also:
- Fix closing div placement
- Hide group if empty

Fix #1360
Close #1372
This commit is contained in:
Bertrand Thierry 2019-10-01 20:19:47 +02:00 committed by George
commit 02b4ce0e68
2 changed files with 7 additions and 6 deletions

View file

@ -26,7 +26,7 @@ subtitle = ""
# Show user's interests? (true/false)
show_interests = true
[design.background]
# Apply a background color, gradient, or image.
# Uncomment (by removing `#`) an option to apply it.

View file

@ -21,13 +21,15 @@
{{ end }}
{{ range $page.Params.content.user_groups }}
{{ $query := where (where site.Pages "Section" "authors") ".Params.user_groups" "intersect" (slice .) }}
{{if $query}}
<div class="col-md-12">
<h2 class="mb-4">{{ . | markdownify }}</h2>
</div>
{{end}}
{{ $query := where (where site.Pages "Section" "authors") ".Params.content.user_groups" "intersect" (slice .) }}
{{ range $query }}
{{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }}
{{/* Get link to user's profile page. */}}
{{ $link := "" }}
@ -50,10 +52,9 @@
<h2>{{with $link}}<a href="{{.}}">{{end}}{{ .Params.name }}{{if $link}}</a>{{end}}</h2>
{{ with .Params.role }}<h3>{{ . | markdownify | emojify }}</h3>{{ end }}
{{ if $show_social }}{{ partial "social_links" . }}{{ end }}
{{ if and $show_interests .Params.interests }}<p class="people-interests">{{ delimit . ", " | markdownify | emojify }}</p>{{ end }}
{{ end }}
{{ if and $show_interests .Params.interests }}<p class="people-interests">{{ delimit .Params.interests ", " | markdownify | emojify }}</p>{{ end }}
</div>
</div>
{{ end }}
{{ end }}
</div>