Search code examples
markdowngatsbyremarkjs

How to define frontmatter fields for gatsby-transformer-remark?


Is it possible to define the allowed fields including defaults for gatsby-transformer-remark? As long as all markdown fields have the same set of fields everything is fine. But not all fields are always required and I tend to forget to add them. This results in breaking GraphQL queries.

So, it would be cool to be able to define these fields. Can someone point me to the right location. So far I haven't found any hint on it.


Solution

  • As of today (30/12/2018) you can't define default values / leave out some fields. The queries will break without them as you already have realized.

    You should follow this issue to be notified when it's possible (as it will solve these issues): https://github.com/gatsbyjs/gatsby/issues/4261