Skip to content

Commit

Permalink
ensures speaker's multiple talks in a single event display
Browse files Browse the repository at this point in the history
The performance improvement in devopsdays#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 devopsdays#643 (comment)
Replaces devopsdays-web f944fea71d071b959f715e9cdcb0ebb00f52c978
  • Loading branch information
tgross committed Sep 13, 2018
1 parent ead71fe commit 694a38a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions layouts/speaker/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ <h2 class="speaker-page">{{ .Title }}</h2>
<h3>{{ .Title }} at {{ $e.city }} {{$e.year}}</h3>
<ul class="list-group">
{{- $.Scratch.Set "speaker" .File.BaseFileName -}}

{{- $p := $.Site.GetPage (printf "events/%s/program/%s" $e.name ($.Scratch.Get "speaker")) -}}
{{- if $p -}}
{{- with $p -}}
{{ range where (where $.Site.Pages "Type" "talk") ".Dir" "=" (print "events/" $e.name "/program/") }}
<!-- Now we can display stuff! -->
{{- range .Params.speakers -}}
{{- if eq . ($.Scratch.Get "speaker") -}}
Expand All @@ -30,8 +27,7 @@ <h3>{{ .Title }} at {{ $e.city }} {{$e.year}}</h3>
<a href = "{{ .Permalink | absURL }}" class= "list-group-item list-group-item-action">{{ .Title }}</a>
{{ $.Scratch.Set "display" "false" }}
{{- end -}}
{{- end -}} <!-- end with -->
{{- end -}} <!-- end if $p -->
{{- end -}} <!-- end range where -->
</ul>
</div>
</div>
Expand Down

0 comments on commit 694a38a

Please sign in to comment.