Comments in Markdown files or front matter?


I often find myself wanting to store some meta info in a page. This could be notes for myself about why I wrote as I did, etc.

I can put inline HTML comments like: <!-- comment -->, however, this will expose these comments publicly, which is not what I want.

How can I put comments in a page to have Jekyll just ignore it and not publish it?

Either in the actual Markdown content (preferably) or alternatively, in the front matter?

For templates the following works.
Do try if these work for markdown as well :

{% comment %} 
    These commments will not include inside the source.
{% endcomment %}
1 Like

Another approach: Use the compress.html layout (, that removes comments from the build.

1 Like

compress.html is fantastic! Thanks