Using {% include %} with templates


I am setting up my GitHub page and chose one of its theme. I want to also add some other features, e.g. MathJax. So I need to insert some <script></scripts> tags into the <head></head>. The only way I figure out how to do it now is to copy the theme’s _layouts/default.html to the local repository and insert a {% include head.html %} into its <head></head> tag, with _includes/head.html where I put the tags I want to insert.

This seems like of heavy handed because now I have to keep my local _layouts/default.html in sync with the theme’s version manually. Is there a way to insert header without keeping a local copy of of the default layout? Or does this has to be change on the theme’s side?



You’re going about it the correct way. Unless the theme adds some sort of config option to enable MathJax you’ll always have to do this sort of customization work.