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

Commit 3fedab6

Browse files
committed
Add directory check to legacy speaker page section
This ensures that it new events without speakers can use the speaker template without errors. Signed-off-by: Matt Stratton <[email protected]>
1 parent b84fa65 commit 3fedab6

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

layouts/speakers/single.html

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,32 @@ <h3 class="card-title speakers-page"><a href = "{{ .Permalink }}">{{ .Title }}</
3333
</div>
3434

3535
<!-- old stuff -->
36+
37+
3638
{{- if ne ($.Scratch.Get "speakers-exist") "true" -}}
3739
{{ .Content }}
38-
39-
{{- range $fname, $s := index .Site.Data.speakers (print (chomp $e.year)) (substr $e.name 5) -}}
40-
<div class="row">
41-
<div class="col-md-12 col-lg-3">
42-
<img alt = "{{ $s.name }}" src = "{{ (printf "events/%s/speakers/%s.jpg" $e.name $fname) | absURL }}" class="speakers-page old-speaker">
43-
</div>
44-
<div class= "col-md-12 col-lg-9 old-speaker-bio speakers-page">
45-
<h3><a href="{{ (printf "events/%s/program/%s" $e.name $fname) | absURL}}">{{ $s.name }}</a></h3>
46-
{{ if $s.twitter }} <a href="https://twitter.com/{{ $s.twitter }}">@{{ $s.twitter }}</a><br>{{ end }}
47-
{{ if $s.website }}Website: <a href="{{ $s.website }}">{{ $s.website }}</a><br>{{ end }}
48-
{{ if $s.pronouns }}Pronouns: {{ $s.pronouns }}{{ end }}
49-
<br>
50-
{{ $s.bio | markdownify }}
51-
<hr>
40+
{{- $.Scratch.Set "yeardir" (printf "data/speakers/%s/" (print (chomp $e.year))) -}}
41+
{{- $.Scratch.Set "citydir" (substr $e.name 5) -}}
42+
{{- if (where (readDir "data/speakers") "Name" (chomp $e.year)) -}}
43+
{{- if (where (readDir ($.Scratch.Get "yeardir")) "Name" ($.Scratch.Get "citydir")) -}}
44+
{{- range $fname, $s := index .Site.Data.speakers (print (chomp $e.year)) (substr $e.name 5) -}}
45+
<div class="row">
46+
<div class="col-md-12 col-lg-3">
47+
<img alt = "{{ $s.name }}" src = "{{ (printf "events/%s/speakers/%s.jpg" $e.name $fname) | absURL }}" class="speakers-page old-speaker">
48+
</div>
49+
<div class= "col-md-12 col-lg-9 old-speaker-bio speakers-page">
50+
<h3><a href="{{ (printf "events/%s/program/%s" $e.name $fname) | absURL}}">{{ $s.name }}</a></h3>
51+
{{ if $s.twitter }} <a href="https://twitter.com/{{ $s.twitter }}">@{{ $s.twitter }}</a><br>{{ end }}
52+
{{ if $s.website }}Website: <a href="{{ $s.website }}">{{ $s.website }}</a><br>{{ end }}
53+
{{ if $s.pronouns }}Pronouns: {{ $s.pronouns }}{{ end }}
54+
<br>
55+
{{ $s.bio | markdownify }}
56+
<hr>
57+
</div>
5258
</div>
53-
</div>
5459

60+
{{- end -}} <!-- end ranging over old stuff-->
61+
{{- end -}}
5562
{{- end -}}
5663
<style>
5764
img.old-speaker {

0 commit comments

Comments
 (0)