contentlayerdev / contentlayer

Contentlayer turns your content into data - making it super easy to import MD(X) and CMS content in your app
https://www.contentlayer.dev
MIT License
3.33k stars 201 forks source link

Contentlayer is a must & multiple content sources #53

Closed alvesvin closed 2 years ago

alvesvin commented 2 years ago

Hey 👋

I came across Contentlayer by a Lee Robinson's live about his blog and I instantly fell in love. I'm really excited about this project and I think this is going to be the next standard way of consuming content from multiple sources. I'm really excited to contribute because I feel Contentful is a must for the web dev community, but I'm not used to contributing at all. I'll dedicate my next days studying this repository to really understand it, but if a great soul could provide a overall architechture/understanding of all the packages and how they fit together, that'd be awesome.

Update: I just watched the Effect Time: Intro to Contentlayer and it's a great introduction. It's more complex than I expected 🥲

What I expect about Contentlayer is that it's going to be the single source of any kind of content a project needs. Instead of using multiple libraries to interact with third party services, Contentlayer would be the only one library needed. Is it correct?

One thing I noticed by quickly looking at the examples is that contentlayer.config.ts only exports one source of content. I don't know if such a case exists were a project consumes content from multiple CMS, for example, at the same time. If such a project exists, would it be possible to export multiple content sources like:

import { makeSourcePlugin } from '@contentlayer/source-contentful'
import { makeSource } from '@contentlayer/source-files'

export const mdx = makeSource({});
export const contentful = makeSourcePlugin({});

And using it like:

import { mdx, contentful } from "./contentlayer/data";

mdx.allPost();
contentful.allPost();

// Proposed syntax
//
// mdx.posts.list()
// contentful.posts.list()

I really like the generated Prisma client, and I think the proposed syntax is very elegant.

schickling commented 2 years ago

Thanks a lot for your kind message. There's now a new issue that tracks your requested feature: #84