Produce a Python blog post with figures
To create a Hugo blog post with Python code and figures, I export an ipython notebook as a .md file. The result is a .zip file containing the .md file and images for the figures. A little modification is needed to get these files just right so that when Hugo builds my website, the post is ready to go with no blank figures. After exporting the jupyter / ipython notebook as .md, by default any images’ filenames have output as the prefix. If I can figure out how to set a custom prefix, those following steps which involve file renaming will be moot.
Here are the steps needed after exporting the notebook to .md format:
- Move the .md file to
garylarson.github.io-builder/content/post/or other relevant subfolder of.../content/. For most posts this will be thepostfolder. - Change prefix of image files from “output” to something unique like the blog post’s title.
- Move those image files to the subfolder
garylarson.github.io-builder/static/images/. - Open the .md file and change the image file references from e.g.
output_2_1.pngto/images/python-regression_2_1.png - Build the site.