jekyll   jupyter_notebook  
HelloJekyll

So I've spent the weekend figuring out how to properly embed Jupyter notebooks into my Jekyll site. Overall, I'm happy with my results. I managed to adjust the font-colors of the various CSS classess and embed my plots nicely in here. I also learned how to include my own images and embed audio into my Jupyter notebooks and have them play after the conversion to html.

My current procedure for doing this is as follows:

  • Download Jupyter Notebook (.ipynb) as a .html
  • Copy the contents of the resulting html file into a Jekyll post with the appropriate header
  • Remove the DOCTYPE and html lines contained within the html file made from the Jupyter notebook

In addition to those steps, I also slightly modified the 'default.html' file and made a 'jupyter.html' file based on the files that came from the Jekyll website template I'm using. This allowed me to preserve the post headers and control the footers of my site since they were behaving kinda wonky (i.e., the image associated with the post was not showing up, the jupyter notebook was off-center, and the footer links were messed up). That being said, if you follow the above three steps, you'll be able to see your Jupyter notebook in your Jekyll site.


I also tried (perhaps an instance of me trying to get too fancy too soon) to embed interactive plots using plotly in my jekyll site. Unfortunately, that has proven to be quite challenging so far since the conversion from the .ipynb to html using nbconv seems to have an issue with the javascript associated with plotly. I've tried modifying the javascript but haven't been successful yet in rendering my interactive visualizations.

If you are trying to use plotly in your Jupyter Notebooks and have them displayed in your Jekyll site, here are a few links that may be useful to you:

  • https://davistownsend.github.io/blog/PlotlyBloggingTutorial/
  • https://stackoverflow.com/questions/50546971/embedding-plotly-interactive-graphs-into-blog-without-losing-animation
  • https://stackoverflow.com/questions/72378397/about-plotly-how-can-i-post-it-for-my-github-pages

Updated: