contentlayerdev / contentlayerdev/contentlayer

Define body as a field

Abierto
#92 1 comentario 0 reacciones 0 asignados Ver en GitHub
meta: never-stale
Lenguaje dominante
TypeScript
Estrellas
3.5k
Forks
192
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Building on #91, `body` is the one field that feels a little too magical. It _just works_, which is great, but maybe not entirely obvious.

Putting this issue here to discuss separately.

One thought I had was that if we pursued #91, it'd justify this move more to me. In this case, the `fields` definition would contain **every property** in the document that is generated without a preceding underscore (generated/reserved).

While I like the magic, I also wouldn't mind being more explicit in my schema definition. We could remove the `bodyType` option and instead have something like this:

```js
fields: {
title: { type: 'string', required: true },
body: { type: 'mdx', source: 'body' }
}
```

This is just a first pass. TBH I don't like the shape of the API suggested above. Just something to get us thinking about this.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.