Skip to content

Contentlayer is a must & multiple content sourcesΒ #53

Closed
@alvesvin

Description

@alvesvin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions