contentlayerdev / contentlayerdev/contentlayer

Add support for multiple sources

未关闭
#84 11 条评论 20 个 reaction 已指派 0 人 在 GitHub 查看
feature
主要语言
TypeScript
星标
3.5k
派生
192
PR 合并指标
30 天内没有已合并 PR

描述

Currently, Contentlayer looks for a single exported method that is pulled from one particular source. We've received requests to support more than one source within the same configuration. I'm working to get more information on specific use cases.

## Considerations

What are the challenges with this approach?

## Design

What would the API for this look like? Perhaps you could define sources separately and then reference the source at the document level? And include the option for a default source.

Napkin sketch:

```js
const ctfl = makeSource({ type: 'contentful', accessToken: /* ... */ })
const local = makeSource({ type: 'local', path: /* ... */ })

const Page = defineDocumentType({ source: ctfl })
const Post = defineDocumentType({})

export default {
defaultSource: local,
documentTypes: [Page, Post]
}
```

贡献指南

打开贡献指南

调研方向

未指定任何文件或测试。先阅读现有的 makeSource、defineDocumentType 和 configuration API,然后将它们与提议的 napkin sketch 进行比较;当用例和挑战得到解决,并且达成一致的 API 支持多个源、文档级选择和默认源时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
backend-api-design, content
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
20/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。