Skip to content

Commit

Permalink
Change MathJax script to execution to be deferred and uncache the hea…
Browse files Browse the repository at this point in the history
…d partial
  • Loading branch information
foo-dogsquared committed Sep 10, 2019
1 parent db1a6ea commit 1d1c431
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="{{ $.Site.Language }}" >
<head>
{{ partialCached "head.html" . -}}
{{ partial "head.html" . -}}
</head>
<body class="site">
{{- $isNotTopLevelPage := and (eq .Kind "page") (ne .File.Dir "/") -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
{{ if $.Site.Params.enableMathjax -}}
{{ partial "config/mathjax.html" . }}
{{ if $.Site.Params.setMathjaxToV2 -}}
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/latest.js?config=TeX-MML-AM_CHTML" async></script>
<script defer type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/latest.js?config=TeX-MML-AM_CHTML"></script>
{{- else -}}
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
{{- if $.Site.Params.useLocalMathjax -}}
{{ $mathjaxLib := resources.Get "js/lib/mathjax.js" | minify }}
{{ $array = $array | append $mathjaxLib }}
{{- else -}}
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script defer id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
{{- end -}}
{{- end -}}
{{- end -}}
Expand Down

0 comments on commit 1d1c431

Please sign in to comment.