Jekyll Class Names

Filed under: design

Sometimes you might want to add classnames on a per post basis for just one or two items. You can easily do that with adding a block that is encapsulated with the {:refdef:} like the following example:

{:refdef: class="specific_class_name"}
<img border="0" src="image.jpg" >
{: refdef}

Note that this is for kramdown formatted markdown1, which you would also need to specify for your jekyll instance by turning on this mode in your configs. Update your _config.yml with markdown: kramdown

I’m doing this for the images that I want to be stylized a certain way on this blog. An example of this being used would be the post on Pretty Macbook Covers for 2018, where I added a classname to center the image to the post paragraphs.

  1. You can read more about formatting for Kramdown by reading the documentation ↩︎