You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today we have fields and computedFields. The definitions in computedFields expects a function to which Contentlayer passes the processed document.
I'd rather be able to define all my fields in one place and allow the options of that field definition (presence of resolve) to determine whether or not it should be computed. Thus, I could have a doc type def like this:
To do this and still support current use cases, it'd be beneficial to not just pass the processed doc object, but also input data. (See #76 for an example use case.) IOW the shape of the doc passed to the resolve function might include the following properties:
_raw would still be there as it is today
frontmatter would contain the raw frontmatter content
body (configurable) would contain the processed body
The text was updated successfully, but these errors were encountered:
A few things the current format has going for it are:
simplicity: the type definitions for fields and computedFields is easier to manage as separate signatures, combining them smells like the poision of D.R.Y zealotry.
Today we have
fields
andcomputedFields
. The definitions incomputedFields
expects a function to which Contentlayer passes the processed document.I'd rather be able to define all my fields in one place and allow the options of that field definition (presence of
resolve
) to determine whether or not it should be computed. Thus, I could have a doc type def like this:To do this and still support current use cases, it'd be beneficial to not just pass the processed doc object, but also input data. (See #76 for an example use case.) IOW the shape of the
doc
passed to theresolve
function might include the following properties:_raw
would still be there as it is todayfrontmatter
would contain the raw frontmatter contentbody
(configurable) would contain the processed bodyThe text was updated successfully, but these errors were encountered: