Lego2012
9/26/2016 - 9:19 PM

Images in Blog Posts

Images in Blog Posts

Jekyll has no standard way to add images to blog posts. Current solutions include:

Putting all images in a single folder.
Putting all images in a single folder, prefixed with the post name.
Grouping all images in folders by post and linking manually.

A good solution for this problem would:

Allow users to group images by post.
Allow users to keep their images and posts together.
Produce image URLs automatically.

A great solution would also generate thumbnails and compress images automatically.

This last option is possible only because this website uses a build system takes images from directories near the source files, converts them, and places them in folders in predetermined locations. Instead of the usual markdown syntax Caption of Image, use {% include blogimage src="/path/to/image.png" caption="Caption of Image" %}. This file, in the includes folder, contains the rest of the code.