# Specifying multiline front matter

**URL:** <https://talk.jekyllrb.com/t/specifying-multiline-front-matter/2896>\
**Category:** Uncategorized\
**Created:** [May 8, 2019, 8:33pm UTC](https://talk.jekyllrb.com/t/specifying-multiline-front-matter/2896 "2019-05-08T20:33:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ranceh](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/ranceh/32/1671_2.png) [@ranceh](https://talk.jekyllrb.com/u/ranceh)\
**Post date:** [May 8, 2019, 8:33pm UTC](https://talk.jekyllrb.com/t/specifying-multiline-front-matter/2896/1 "2019-05-08T20:33:38Z")

</div>

I’m in the process of porting a theme from Hugo to Jekyll and in Hugo there is this idea called “shortcodes” or small snippets of html that can be included as a variable in a layout.

I don’t see where Jekyll has this, so I figured the best substitute was to just make an include out of it and include it where needed.

So far so good until I needed to include it if a variable is defined in the page front matter.

The variable content is multi-line and Jekyll doesn’t like this and complains. I haven’t found the magic sauce to allow a multi-line variable in a single front matter variable.

In \_config.yml there is a syntax for this very thing, but it isn’t supported from front matter.

Once I figure out how to use the multi-line variable the _if var exists then include that_ part should work just fine.

Thanks for your attention

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [May 8, 2019, 10:50pm UTC](https://talk.jekyllrb.com/t/specifying-multiline-front-matter/2896/2 "2019-05-08T22:50:11Z")

</div>

YAML supports multiline content, see this SO thread:

> <https://stackoverflow.com/questions/3790454/in-yaml-how-do-i-break-a-string-over-multiple-lines>

Now if you’re trying to do a push multiline content to an `include` [parameter](https://jekyllrb.com/docs/includes/#passing-parameters-to-includes), that might not be supported without using Liquid `assign` or `capture` first.

---

<div class="post-metadata">

**Author:** ![ranceh](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/ranceh/32/1671_2.png) [@ranceh](https://talk.jekyllrb.com/u/ranceh)\
**Post date:** [May 14, 2019, 5:34pm UTC](https://talk.jekyllrb.com/t/specifying-multiline-front-matter/2896/3 "2019-05-14T17:34:11Z")

</div>

I don’t think this helps much because when I add front matter to a page like so:

* * *

varname: - \>  
This is my multiline yaml frontmatter  
here.

* * *

I get an error like this:

YAML Exception reading /path/to/file.md: (): block sequence entries are not allowed in this context at line X column Y.

If I put the text all on one line, it works just fine.

Wondering what I am doing wrong, as this appears to work fine from \_config.yml
