How content reaches your site
- Connect Notion in the dashboard, register a database, and wait for its initial synchronization to finish.
- Generate a schema with the CLI. It gives your code database and property names, types, and known select options.
- Fetch synchronized content on your server or during your site’s build.
Read content with types
After setup, import the generated client. This example assumes that your database is calledblog and has a published checkbox:
pull. It enables
editor completion and compile-time checks; it does not validate every value at
runtime. Synchronize and pull again after changing your Notion database.
Choose what to publish
NotCMS does not give a property namedpublished special meaning. Decide which
pages your application should expose and apply that rule to both lists and
individual pages. Keep the secret key on the server. See the
publication recipes for scheduled publication,
languages, and detail-page checks.
Choose a query
- List pages to retrieve properties with optional filters and sorting.
- Fetch one page to retrieve Markdown content by ID or a property such as a slug.
- Handle errors by checking the SDK’s error tuple before using data.