Overview
This integration system allows you to write blog posts directly in Notion and automatically sync them to your website and won't change any existing blog templates or styles!
Workflow
Notion Database → Auto Sync → Markdown Files → Blog HTML → Website Update
Step 1: Create Notion Database
1.1 Create New Database
- Create a new page in Notion
- Add a Database
- Select "Table" view
1.2 Setup Database Fields
Required Fields:- Title - Title type - Article title
- Status - Select type - Options: 'Draft', 'Published'
- Date - Date type - Publication date
- Tags - Multi-select type - Article tags
- Summary - Text type - Article summary
1.3 Database Example
Step 2: Get Notion API Key
2.1 Create Integration
- Visit Notion Integrations
- Click "New integration"
- Fill in the information:
- Click "Submit"
- Copy the Internal Integration Token (keep it secret!)
2.2 Connect Database
- Go back to your Notion database page
- Click the "..." menu in the top right
- Select "Add connections"
- Choose your newly created "Blog Sync" integration
2.3 Get Database ID
- Open your database in the browser
- Copy the database ID from the URL (32-character string)
Step 3: Local Setup
3.1 Set Environment Variables
MacOS/Linux: Add to ~/.zshrc or ~/.bash_profileexport NOTION_TOKEN="your_integration_token_here" export NOTION_DATABASE_ID="your_database_id_here"
3.2 Test Sync (For Joyce)
cd blog python3 sync_notion.py
Step 4: GitHub Automation Setup
4.1 Setup GitHub Secrets
- Visit your GitHub repository
- Click "Settings" → "Secrets and variables" → "Actions"
- Click "New repository secret"
- Add two secrets:
4.2 Auto Sync
GitHub Actions will:
- Automatically check Notion updates daily
- Sync published articles
- Auto build and deploy blog
Step 5: Writing Workflow
5.1 Writing in Notion
- Create a new row in the database
- Fill in title, tags, summary
- Set Status to 'Draft'
- Write content in the page (supports all Notion formats)
5.2 Publishing Articles
- After finishing content, change Status to 'Published'
- Set publication date
- Wait for auto sync (daily) or trigger manually
5.3 Manual Sync
Local Sync:cd blog python3 sync_notion.py
GitHub Manual Trigger:- Visit GitHub repository
- Click "Actions" → "Notion Blog Auto-Sync"
- Click "Run workflow"