How to insert images into posts in Nikola
Since it took me a surprisingly long time to solve this simple problem -- it's not in Nikola's official docs(where they only have a section on galleries) and my Google search was unfruitful, I thought I'd write it down.
The simple trick is based on the fact that Nikola will automatically copy all contents under files/
folder to output/
folder when you run nikola build
.
So here are the steps:
-
Create a subdirectory in
files/
. Sayregex_pic/
(where I put my images for the previous post on parsing regex) -- this is more about better practice, since I don't like to clutter myoutput/
folder. -
Put your images into that folder.
-
In your post, use regular markdown syntax to reference those images. For example:
![simple image1](/regex_pic/simple1.jpg)
will insertregex_pic/simple1.jpg
. -
nikola build
. Done.
Comments
Comments powered by Disqus