Removing Extra Whitespace from Jekyll Templates
I noticed today in this very blog that I had an extra space between the comma and the tag names on my posts:
It got weirder still, because when I opened the inspect window I saw this extra whitespace in the html:
Turns out, when you use the squiggle bracket to evaluate content (see below), it will render a new line even if it evaluates false.
To fix this, we need to insert a ‘-‘ character beside the closing and opening brackets.
This stops the rendering of the extra whitespace: