Преглед изворни кода

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
Bertrand Thierry пре 5 година
родитељ
комит
02b4ce0e68
2 измењених фајлова са 7 додато и 6 уклоњено
  1. 1 1
      exampleSite/content/home/people.md
  2. 6 5
      layouts/partials/widgets/people.html

+ 1 - 1
exampleSite/content/home/people.md

@@ -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.

+ 6 - 5
layouts/partials/widgets/people.html

@@ -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>