Skip to content

Commit

Permalink
Website performance improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-waltermire committed Jun 14, 2021
1 parent 3dcbc84 commit b8af4f3
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,27 +108,37 @@
{{- end }}
{{ end }}

{{ if .HasShortcode "mermaid" }}
{{ $usingMermaid := .HasShortcode "mermaid"}}

{{ if $usingMermaid }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.4.4/mermaid.min.js" integrity="sha256-JEqEejGt4tR35L0a1zodzsV0/PJ6GIf7J4yDtywdrH8=" crossorigin="anonymous"></script>
{{ end }}

<script>
{{ block "foot" . }}
{{ partialCached "foot.html" . }}
{{ end }}

{{ $usingImageMap := .HasShortcode "imagemap" }}

{{ if or $usingMermaid $usingImageMap }}
$(document).ready(function(e) {
{{ if .HasShortcode "mermaid" }}
{{ if $usingMermaid }}
mermaid.initialize();
{{ end }}
{{ if .HasShortcode "imagemap" }}
{{ if $usingImageMap }}
$('img[usemap]').rwdImageMaps();
{{ end }}
});
{{ end }}

{{ $tocEnabled := true }}
{{- with .Page.Params.toc -}}
{{ if isset . "enabled" }}
{{ $tocEnabled = .enabled }}
{{ end }}
{{- end -}}
{{- if $tocEnabled -}}
{{- if $tocEnabled }}
<script>
{{ $headingselectors := "h2,h3,h4" }}
{{ $includeHtml := false }}
{{ $collapseDepth := 0 }}
Expand Down Expand Up @@ -176,10 +186,7 @@
scrollSmoothOffset: 20
});
*/
{{- end -}}
</script>
{{ block "foot" . }}
{{ partialCached "foot.html" . }}
{{ end }}
{{ end -}}
</body>
</html>

0 comments on commit b8af4f3

Please sign in to comment.