Search code examples
yamlescapingjekyll

How to escape < and > in YAML/Jekyll?


I'm trying to escape the characters < and >, e.g. in:

description: "some file <x> bla bla"

Note: x should be generated literally. The generated HTML code always generates a <li> and/or <ul>, because of the < and >, which clearly should not happen.

What I tried is:

  • Using " (like above)
  • Using '
  • using escape characters like \
  • using unicode form like \x..

Solution

  • HTML escaping should do the trick:

    description: "some file &lt;x&gt; bla bla"