Jekyll: escape HTML in titles
23rd December 2019At times, you’ll have posts which don’t have pure text titles. Luckily, Jekyll supports a handy selection of custom filters along with all Liquid filters.
The strip_html
filter is great for Jekyll layouts:
{% raw %}{{ page.title | strip_html }}{% endraw %}
As an additional note, if you need to escape Jekyll snippets in code blocks as above, you can use {% raw %}{% raw %}{% {% endraw %}endraw %}
to embed your content.