Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for multiple sources

See original GitHub issue

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.


What are the challenges with this approach?


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:

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]

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:7
  • Comments:7

github_iconTop GitHub Comments

seancdaviscommented, Feb 23, 2022

@684efs3 We’re not actively working on this feature at this time, though still considering it and looking for more use cases to determine how to shape the API.

In this case, “multiple sources” means that your collection of data is coming from multiple sources (local, headless CMS, API, etc.).

In your case, it sounds like all your data is local, but spread across multiple files. This is what Contentlayer is designed to solve today. You can create an individual document type for content in each directory. You can even process some content types as MDX and others as plain markdown.

684efs3commented, Feb 23, 2022

Ah I see! Apologies! Your comment is very helpful. I’m looking forward to testing it! Thank you very much! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support for multiple Source Systems | Voters - HelloID - Canny
Allow adding multiple source systems. Import should only insert, update, delete identity from a single source system. Each source system has its own...
Read more >
APA Citations (7th ed.): Citing Multiple Works - LibGuides
This guide will help you learn how to properly cite sources in APA style ... Only include citations needed to support your immediate...
Read more >
How can I add multiple sources to an HTML5 audio tag ...
I failed to find how to add multiple sources in an audio element through JavaScript, something similar to source tags shown in the...
Read more >
Create a multiple source automation - NationBuilder HOWTOs
Step 1: Start a multiple source automation · Step 2: Set up emails and time delays within automation · Step 3. Run your...
Read more >
Consolidate multiple worksheets into one PivotTable
Consolidating data is a useful way to combine data from different sources into one report.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found