I came across this excellent tutorial when I tried to add mathjax support to my jekyll site.

Here’s a brief summary:

  • In the _config.yml, add the following lines:
      # Build settings
      markdown: kramdown
    
  • On the top of the posts that you’d like to add mathjax support (it’s called the YAML ‘‘front matter’’) , add the following line:
      usemathjax: true
    
  • Add these lines to _includes/head.html:
        
        <!-- for mathjax support -->
        {% if page.usemathjax %}
          <script type="text/x-mathjax-config">
            MathJax.Hub.Config({
            TeX: { equationNumbers: { autoNumber: "AMS" } }
            });
          </script>
          <script type="text/javascript" async src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
        {% endif %}
        
    
  • After that, simply wrap the math symbols with two double-dollar sign $$:
    $$E=mc^2$$
    

    You should be able to see it in your post as:

Reference:

[1]: https://alan97.github.io/random/mathjax/