diff --git a/templates/collection-post.tmpl b/templates/collection-post.tmpl
index 5baea38..818ec98 100644
--- a/templates/collection-post.tmpl
+++ b/templates/collection-post.tmpl
@@ -30,21 +30,11 @@
{{range .Images}}{{else}}{{end}}
{{if .Collection.StyleSheet}}{{end}}
- {{if .Collection.RenderMathJax}}
-
- {{end}}
+ {{if .Collection.RenderMathJax}}
+
+ {{template "mathjax" . }}
+ {{end}}
{{template "highlighting" .}}
diff --git a/templates/collection-tags.tmpl b/templates/collection-tags.tmpl
index e5c5fdc..fd37eed 100644
--- a/templates/collection-tags.tmpl
+++ b/templates/collection-tags.tmpl
@@ -30,20 +30,11 @@
{{if .Collection.StyleSheet}}{{end}}
+
{{if .Collection.RenderMathJax}}
-
- {{end}}
+
+ {{template "mathjax" .}}
+ {{end}}
{{template "highlighting" . }}
diff --git a/templates/collection.tmpl b/templates/collection.tmpl
index 54f8b2f..b74b96c 100644
--- a/templates/collection.tmpl
+++ b/templates/collection.tmpl
@@ -27,22 +27,12 @@
- {{if .StyleSheet}}{{end}}
- {{if .RenderMathJax}}
-
- {{end}}
+ {{if .StyleSheet}}{{end}}
+ {{if .RenderMathJax}}
+
+ {{template "mathjax" .}}
+ {{end}}
{{template "highlighting" . }}
diff --git a/templates/include/render.tmpl b/templates/include/render.tmpl
index 5a0eb8e..4d7e545 100644
--- a/templates/include/render.tmpl
+++ b/templates/include/render.tmpl
@@ -2,7 +2,8 @@
{{define "highlighting"}}
-
+
{{end}}
+
+
+{{define "mathjax"}}
+
+
+{{end}}