Hi All,
My MathJax loads correctly when previewing my website locally and renders equations as expected.
However, MathJax does not load remotely on my site: Arranging a Two-Parameter Gamma Distribution into Exponential Family Form | Hua (Wally) Xie's Digital Outpost [Site In Progress]. I don’t get an error message for the loading of MathJax from browser consoles.
As far as I can tell, having initially followed the steps in this post (Render LaTeX math expressions in Hugo with MathJax 3 · Geoff Ruddock), I think my code for loading MathJax in my theme partials folder is correct. I have a mathjax_load.html
file:
<script>
MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$','$$'], ['\\[', '\\]']],
processEscapes: true,
processEnvironments: true
},
options: {
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre']
}
};
window.addEventListener('load', (event) => {
document.querySelectorAll("mjx-container").forEach(function(x){
x.parentElement.classList += 'has-jax'})
});
</script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
that is called by my header.html
file:
<html lang="{{ .Site.LanguageCode }}">
<head>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-light.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png">
<link rel="manifest" href="/images/site.webmanifest">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Params.Description }}{{ end }}">
<title>{{ .Title }} | {{ .Site.Title }}</title>
<link rel="stylesheet" href="{{ "/css/style.css" | relURL }}" />
<link rel="stylesheet" href="{{ "/css/fonts.css" | relURL }}" />
{{ range .Site.Params.custom_css -}}
<link rel="stylesheet" href="{{ . | absURL }}">
{{- end }}
{{ partial "mathjax_load.html" . }}
{{ partial "head_custom.html" . }}
</head>
<body>
<br/>
Additionally, I tried fully deleting the Polyfill line from my mathjax_load.html file, but MathJax still shows no signs of loading on browser consoles.
Was asking for some help to see if there was something blatantly wrong with my code, or whether this could be a Netlify issue. Thank you all very much for your time and help.