Gaohaoyang / gaohaoyang.github.io

blog & blog themešŸ¤˜
http://gaohaoyang.github.io
MIT License
1.88k stars 2k forks source link

If mathjax used, it can't be displayed in index page. #128

Open eMous opened 5 years ago

eMous commented 5 years ago

In your head.html page:

  {% if page.mathjax %}
  <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
    tex2jax: { inlineMath: [["$","$"],["\\(","\\)"]] },
    "HTML-CSS": {
      linebreaks: { automatic: true, width: "container" }
    }
});
</script>

But in index.html, it can not expose an variable which is dynamically decided by the post pages to the page head.html which it include.

Inserting an if statment to index.html to parse the posts' excerpts may help. OR Record to site.data files when each post needs mathjax. OR In any case, inject the javascript statment of mathjax.