makeSource
provides Contentlayer with the schema and configuration for your application.
#Usage
The code calling makeSource
should be placed in contentlayer.config.js
.
import { makeSource } from 'contentlayer-source-notion'
export default makeSource({
})
#Options
#client
The @notionhq/client
instance or options to query the Notion API.
Example:
import { Client } from '@notionhq/client'
import { makeSource } from 'contentlayer-source-notion'
const client = new Client({ auth: process.env.NOTION_TOKEN })
export default makeSource({
client,
})
This would use process.env.NOTION_TOKEN
when calling the Notion API.
#renderer
The @notion-render/client
instance or options to transform Notion Block into HTML.
Example:
import { NotionRenderer } from '@notion-render/client'
import { makeSource } from 'contentlayer-source-notion'
const renderer = new NotionRenderer()
export default makeSource({
renderer
})
Your databases definitions for your project. See defineDatabase
for usage.
#fieldOptions
Provides the ability to manipulate how fields are written when parsing the content source.
Options:
bodyFieldName
(default: body
): Name of the field containing the body/content extracted when the body type is markdown
or mdx
.
typeFieldName
(default: type
): Name of the field containing the name of the document type.
Example:
export default makeSource({
fieldOptions: {
bodyFieldName: 'content',
typeFieldName: '__typename',
},
})
Was this article helpful to you?
Provide feedback
Last edited on March 31, 2023.
Edit this page