Include YAML files

Reto's Avatar


22 Apr, 2020 07:53 PM

Hello, everyone,

I am facing a problem with the inclusion of the YAML file. I tried all three variants, which all behave the same:


If I use a file without a value in the first line, everything works fine:

  name: Test Test
  email: [email blocked]

If I use a file with anything else in the first line, nothing at all is displayed.

name: Test Test
email: [email blocked]

Am I doing something wrong or is it an error?


  1. Support Staff 1 Posted by Brett on 22 Apr, 2020 08:05 PM

    Brett's Avatar

    If you’re including this at the top of a file and are using MultiMarkdown, the values are being interpreted as metadata. I’m not sure what you’re trying to do with the included YAML. Do you want it to appear in the document, or be interpreted some other way?


  2. 2 Posted by Reto on 23 Apr, 2020 07:18 AM

    Reto's Avatar

    Thank you, Brett, for your answer.

    I am writing a documentation about Grav where I want to include the config files which are all written in YAML.

    I understand that YAML is interpreted as metadata while including MultiMarkdown files using <<[FILE].

    But to interpret any data while including files using <<(FILE) or <<{{FILE} doesn't make sense to me.

    What is your opinion on this?


  3. Support Staff 3 Posted by Brett on 23 Apr, 2020 12:01 PM

    Brett's Avatar

    You're correct, that is odd behavior, especially since it's true even
    when the included file isn't at the top and it happens even when MMD
    isn't selected. I don't have an immediate explanation or fix, but if you
    include a blank line at the beginning of the YAML file, it appears to
    circumvent the issue (though leaves a blank line at the top of the code

    I'll look into it further, but let me know if that helps for now.


  4. 4 Posted by Reto on 24 Apr, 2020 08:01 AM

    Reto's Avatar

    The workaround with the blank line at the top of the file works for me. Thank you.

    For the <<(FILE) include syntax I have a few ideas which would make it even more useful in my opinion:
    - Definition of a language similar to the code block syntax - Line numbering - Include just line Y to Z of a file

    Best regards,

  5. Support Staff 5 Posted by Brett on 24 Apr, 2020 10:00 AM

    Brett's Avatar

    Those are great ideas, I'll take them into consideration.


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac