hugo-soresu

My fork of hugo-xmin

git clone git://git.shimmy1996.com/hugo-soresu.git
commit b73b7cef397274dcf6188a2a8ee45a2f3be6614e
parent 386de004c1fc19b16dad3f9b2f3971089c726f4c
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Sat, 23 Jun 2018 19:40:10 -0500

Add option to disable Latex and load latex files in header instead.

Diffstat:
Mlayouts/partials/footer.html | 1-
Mlayouts/partials/header.html | 1+
Mlayouts/partials/katex.html | 8+++++---
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
@@ -1,6 +1,5 @@
 <hr/>
 <footer>
-  {{ partial "katex.html" . }}
   {{ with .Site.Copyright }} {{ . | markdownify }} {{ end }}
 </footer>
 </body>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
@@ -5,6 +5,7 @@
   <meta name="viewport" content="width=device-width, initial-scale=1">
   {{ partial "favicon.html" . }}
   {{ partial "stylesheet.html" . }}
+  {{ partial "katex.html" . }}
   {{ $title := i18n (lower .Title) }}
   {{ if eq $title "" }}
     <title>{{.Title}} | {{.Site.Title}}</title>
diff --git a/layouts/partials/katex.html b/layouts/partials/katex.html
@@ -1,3 +1,5 @@
-<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0-alpha/dist/katex.min.css" integrity="sha384-BTL0nVi8DnMrNdMQZG1Ww6yasK9ZGnUxL1ZWukXQ7fygA1py52yPp9W4wrR00VML" crossorigin="anonymous" />
-<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0-alpha/dist/katex.min.js" integrity="sha384-y6SGsNt7yZECc4Pf86XmQhC4hG2wxL6Upkt9N1efhFxfh6wlxBH0mJiTE8XYclC1" crossorigin="anonymous"></script>
-<script defer onload="renderMathInElement(document.body);" src="https://cdn.jsdelivr.net/npm/katex@0.10.0-alpha/dist/contrib/auto-render.min.js" integrity="sha384-IiI65aU9ZYub2MY9zhtKd1H2ps7xxf+eb2YFG9lX6uRqpXCvBTOidPRCXCrQ++Uc" crossorigin="anonymous"></script>
+{{ if (or (not .Site.Params.soresuLatexOffByDefault) (.GetParam "latex")) }}
+  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0-alpha/dist/katex.min.css" integrity="sha384-BTL0nVi8DnMrNdMQZG1Ww6yasK9ZGnUxL1ZWukXQ7fygA1py52yPp9W4wrR00VML" crossorigin="anonymous" />
+  <script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0-alpha/dist/katex.min.js" integrity="sha384-y6SGsNt7yZECc4Pf86XmQhC4hG2wxL6Upkt9N1efhFxfh6wlxBH0mJiTE8XYclC1" crossorigin="anonymous"></script>
+  <script defer onload="renderMathInElement(document.body);" src="https://cdn.jsdelivr.net/npm/katex@0.10.0-alpha/dist/contrib/auto-render.min.js" integrity="sha384-IiI65aU9ZYub2MY9zhtKd1H2ps7xxf+eb2YFG9lX6uRqpXCvBTOidPRCXCrQ++Uc" crossorigin="anonymous"></script>
+{{ end }}