Skip to content
This repository was archived by the owner on Jul 21, 2019. It is now read-only.

Commit 694a38a

Browse files
committed
ensures speaker's multiple talks in a single event display
The performance improvement in #644 to the speaker page implicitly (and incorrectly) assumes that a speaker will give a single talk per event. Rather than using .GetPage which can return only a single page, we can change the original call to .Site.Pages and get the correct behavior with at least some of the performance improvement. This could be further improved if the program YAML included the event name, or if Hugo supported a "contains" or "startswith" operator in the where function. Fixes #643 (comment) Replaces devopsdays-web f944fea71d071b959f715e9cdcb0ebb00f52c978
1 parent ead71fe commit 694a38a

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

layouts/speaker/single.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ <h2 class="speaker-page">{{ .Title }}</h2>
1616
<h3>{{ .Title }} at {{ $e.city }} {{$e.year}}</h3>
1717
<ul class="list-group">
1818
{{- $.Scratch.Set "speaker" .File.BaseFileName -}}
19-
20-
{{- $p := $.Site.GetPage (printf "events/%s/program/%s" $e.name ($.Scratch.Get "speaker")) -}}
21-
{{- if $p -}}
22-
{{- with $p -}}
19+
{{ range where (where $.Site.Pages "Type" "talk") ".Dir" "=" (print "events/" $e.name "/program/") }}
2320
<!-- Now we can display stuff! -->
2421
{{- range .Params.speakers -}}
2522
{{- if eq . ($.Scratch.Get "speaker") -}}
@@ -30,8 +27,7 @@ <h3>{{ .Title }} at {{ $e.city }} {{$e.year}}</h3>
3027
<a href = "{{ .Permalink | absURL }}" class= "list-group-item list-group-item-action">{{ .Title }}</a>
3128
{{ $.Scratch.Set "display" "false" }}
3229
{{- end -}}
33-
{{- end -}} <!-- end with -->
34-
{{- end -}} <!-- end if $p -->
30+
{{- end -}} <!-- end range where -->
3531
</ul>
3632
</div>
3733
</div>

0 commit comments

Comments
 (0)