Currently, exports.data = { /* ... */ } is being used, which could also be written as export const data = { /* ... */ }, but the latter option can be inconvenient _(variable name clashes may occur)_ when a GraphQL query is also in place for the given JSX.
I would like to propose using export const frontmatter = { /* ... */ } in order to avoid confusion and improve consistence with markdown file handling.
/cc @jbolda
In the past, I had more plans for this so I went with the more generic data. Those plans are pretty much now defunct though, and it seems to be only worthwhile to use this for frontmatter. I think, in an effort of discoverability and backward compatibility, we actually deprecate this package. Then we make a new package, gatsby-transformer-javascript-frontmatter, and make your proposed change. I think this will help others discover this package as I have noticed in the past that this package isn't quite obvious what it does at first glance. @KyleAMathews, are you amenable to this?
@jbolda makes sense to me! Yeah, a more narrow package is easier to understand and discover.
It might be good to mention when and how to use this data. For example, I know that I can query the data with GraphQL, but how can I access it in the onCreatePage function in gatsby-node.js?
Most helpful comment
In the past, I had more plans for this so I went with the more generic data. Those plans are pretty much now defunct though, and it seems to be only worthwhile to use this for frontmatter. I think, in an effort of discoverability and backward compatibility, we actually deprecate this package. Then we make a new package,
gatsby-transformer-javascript-frontmatter, and make your proposed change. I think this will help others discover this package as I have noticed in the past that this package isn't quite obvious what it does at first glance. @KyleAMathews, are you amenable to this?