Hugo Tips

Posted by Matt Wang on Thursday, June 11, 2020

Shortcode Collection

Enable MathJax

Add following lines into theme/<theme>/layout/partials/math.html

<script
  src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
  type="text/javascript"
></script>

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$']]}  });
</script>

and put following lines in any template that the target page used:

{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}

and then put the parameter math: true in the header of the article page to enable MathJax.

Simple SEO