Overview
Unlike blog posts and projects which use Notion databases, static pages are individual Notion pages that are fetched at build time. This is useful for content-heavy pages like your homepage, about page, or custom landing pages.Static Pages vs Collections
This site uses two different Notion content strategies:| Type | Source | Use Case | Sync Method |
|---|---|---|---|
| Static Pages | Individual Notion pages | Homepage, about, custom pages | Fetched at build time via API |
| Collections | Notion databases | Blog posts, projects, repeated content | Pre-build sync to MDX files |
Static pages are fetched fresh during each build using the Notion API, while collection content is synced to local MDX files during the pre-build step.
Environment Variables
Static pages are referenced by their Notion page IDs in environment variables:Getting a Notion Page ID
Extract the page ID
The URL looks like:The page ID is the 32-character string at the end (with dashes removed):
Creating a Static Page
Create a Notion page
Create a new page in Notion with your content. Use any Notion blocks you want - headings, paragraphs, images, etc.
Share with integration
Make sure your Notion integration has access to this page:
- Click “Share” in the top right
- Invite your integration
Fetching Page Content
There are two main functions for working with Notion pages:getPage()
Fetches page metadata and properties (src/lib/notion-cms-page.ts:9-25):
getBlock()
Fetches page content blocks recursively (src/lib/notion-cms.ts):
Full Example
Build-Time Rendering
Static pages are rendered at build time, not on every request:This means updates to your Notion page won’t appear on your site until you rebuild and redeploy. This is intentional for performance and reliability.
Updating Static Pages
Trigger a rebuild
Rebuild your site locally or trigger a deployment:Or push to your main branch to trigger automatic deployment.
Advanced: Custom Content Processing
You can process Notion content before rendering:Example: Homepage with Sections
You can structure complex pages by using Notion’s heading blocks as section dividers:Navigation Integration
The site’s navigation menu is also dynamically generated from Notion (NOTION_DB_ID_PAGES):
- Add entry to the
NOTION_DB_ID_PAGESdatabase - Set the name, path, and order properties
- Rebuild your site
Best Practices
Use descriptive environment variable names
Use descriptive environment variable names
Name your page IDs clearly:This makes it easy to understand which page is which.
Keep pages focused
Keep pages focused
Static pages work best for:
- Landing pages (homepage, about)
- Policy pages (privacy, terms)
- Long-form content pages
Cache-bust on deploy
Cache-bust on deploy
Since content is fetched at build time, make sure your deployment triggers a fresh build when you want updates to go live.
Structure with headings
Structure with headings
Use Notion’s heading blocks (H1, H2, H3) to create clear content structure. This helps with SEO and makes content easier to navigate.
Troubleshooting
Page content not updating
Check:- You’ve triggered a rebuild after editing the Notion page
- The page ID in your environment variables is correct
- Your Notion integration still has access to the page
Build fails when fetching page
Check:- Page ID is correct (32 characters, no dashes)
- Environment variable is set and accessible
- Notion integration has access to the page
- Notion API is accessible (check Notion status page)
Content rendering incorrectly
Check:- You’re using
set:htmlto render the parsed content - The content is wrapped in an element with proper styling (e.g.,
proseclass) - Block types are supported (see Notion Blocks)
When to Use Static Pages vs Collections
Choose static pages when:- Content is unique (homepage, about, contact)
- You need full control over the page structure
- Content doesn’t follow a repeating template
- You have multiple similar items (blog posts, projects)
- Content follows a consistent template
- You want to query, filter, and sort items
- You need pagination or category pages