This seems like something basic, but I can’t figure out why it doesn’t work. I have MathJax on my blog, but only 10% or so of my pages actually use it, so I figure I should just include it for those posts by having a flag in the front matter. Thus, I changed my header file to this:
{{ if .Params.useMath }}
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_CHTML">
MathJax.Hub.Config({
asciimath2jax: { delimiters: [['$$','$$']] }
});
</script>
{{ end }}
And added “useMath=true” to the front matter one of my posts which use math. Unfortunately, this seems to evaluate to false when generating the post. If I change the if statement to {{ if or 1 .Params.useMath }} then MathJax comes back so it seems like it has something to do with accessing the front matter. I tried following the instructions here for accessing the front matter: http://gohugo.io/templates/go-templates/#using-content-page-parameters:e2fc23c6497b774f0cb0b339042e10c3 but something isn’t working right.
My version string is: Hugo Static Site Generator v0.15 BuildDate: 2015-12-27T20:05:11-08:00