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 used 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 used 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 April 01, 2024.
Edit this page