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

Commit

Permalink
Merge pull request #644 from tgross/build_performance
Browse files Browse the repository at this point in the history
improves template rendering performance
  • Loading branch information
bridgetkromhout authored Aug 27, 2018
2 parents 28e6c40 + a2ee444 commit 0109891
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
{{- end -}}
</div>
</div>
{{- partial "footer.html" . -}}
{{- partialCached "footer.html" . -}}
{{- partial "footer_scripts.html" . -}}
</body>
</html>
12 changes: 6 additions & 6 deletions layouts/speaker/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ <h2 class="speaker-page">{{ .Title }}</h2>
<h3>{{ .Title }} at {{ $e.city }} {{$e.year}}</h3>
<ul class="list-group">
{{- $.Scratch.Set "speaker" .File.BaseFileName -}}
{{- range where $.Site.Pages "Type" "talk" -}}
{{- if eq (index (split (.Permalink | relURL) "/") 2) $e.name -}}

{{- $p := $.Site.GetPage (printf "events/%s/program/%s" $e.name ($.Scratch.Get "speaker")) -}}
{{- if $p -}}
{{- with $p -}}
<!-- Now we can display stuff! -->
{{- range .Params.speakers -}}
{{- if eq . ($.Scratch.Get "speaker") -}}
Expand All @@ -28,12 +30,10 @@ <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 if eq $talk_slug $event_slug -->
{{- end -}} <!-- end range where $.Site.Pages "Type" "speaker" -->
{{- end -}} <!-- end with -->
{{- end -}} <!-- end if $p -->
</ul>
</div>
<!-- </div>
</div> -->
</div>
<div class = "col-md-3 offset-md-1">
{{- if isset .Params "image" -}}
Expand Down
12 changes: 5 additions & 7 deletions layouts/talk/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,10 @@ <h2 class="talk-page">Speaker</h2>

{{- range .Params.speakers -}}
{{- $.Scratch.Set "speakername" . -}}
{{- range where $.Site.Pages "Type" "speaker" -}}
{{- if eq (index (split (.Permalink | relURL) "/") 2) $e.name -}}
{{- if eq .File.BaseFileName ($.Scratch.Get "speakername") -}}
<a href = "{{ (printf "events/%s/speakers/%s" $e.name ($.Scratch.Get "speakername")) | absURL}}">
{{- if isset .Params "image" -}}
{{- $p := $.Site.GetPage (printf "events/%s/speakers/%s" $e.name ($.Scratch.Get "speakername")) -}}
{{- if $p -}}
{{- with $p -}}
{{- if isset .Params "image" -}}
{{- if ne .Params.image "" -}}
<img src = "{{ (printf "events/%s/speakers/%s" $e.name .Params.image) | absURL }}" class="img-fluid" alt="{{ $.Scratch.Get "speakername" }}"/><br /><br />
{{- end -}}
Expand Down Expand Up @@ -167,8 +166,7 @@ <h4 class="talk-page"><a href = "{{ (printf "events/%s/speakers/%s" $e.name ($.S
{{- end -}}

{{- end -}}
{{- end -}} <!-- end range where $.Site.Pages "Type" "speaker" -->
{{- end -}}
{{- end -}}<!-- end with -->
{{- else -}}<!-- now show the old stuff -->
<h2 class="talk-page">Speaker</h2>
{{- range $fname, $s := index .Site.Data.speakers (print (chomp $e.year)) (substr $e.name 5) -}}
Expand Down

0 comments on commit 0109891

Please sign in to comment.