Jekyll/Liquid – how to add large blocks of text to YAML front matter?

Yaml syntax for multi-line strings is this one:

body: |
  This is a multi-line string.
  "special" metacharacters may
  appear here. The extent of this string is
  indicated by indentation. 

Notice that the first line must be an space followed by the | character and a new line. Then you must indent the text one level more than its parent.

Consequently, you can create one item this way:

item1:
  overview: |
    overview text
    more overview text
  available_to: 2012-01-01
  foo: |
    foo text
    more foo text

It seems to me that you also want to arrange your items in order. You can employ a yaml list for that:

catalog:
  - id: item 1
    overview: |
      overview text
      more overview text
    available_to: 2012-01-01
    foo: |
      foo text
      more foo text
    ...
  - id: item2
    overview: <similar to above>

Leave a Comment