Welcome to the documentation portal for the CoMapeo platform. This site is built with Docusaurus, which powers a modern static website and supports features like multilingual content and automatic Markdown generation from our Notion database.
Install all dependencies with:
bun i
This repository uses a two-branch architecture to separate code from generated content:
mainbranch: Source code, TypeScript scripts, workflows, and configuration (~1MB)contentbranch: Generated documentation from Notion (docs/, i18n/, static/images/ ~29MB)
Why separate branches?
- Keeps main branch clean for code review and development
- Reduces repository clone time for contributors
- Separates content syncs from code changes
- Improves CI/CD performance and clarity
Before local development, you need content files. Choose one of these methods:
Option 1: Fetch from content branch (Recommended - Fast)
git fetch origin content
git checkout origin/content -- docs/ i18n/ static/images/Option 2: Generate from Notion (Requires API access)
- Copy
.env.exampleto.envand add your Notion API key and Database ID - Fetch content:
bun notion:fetchThe bun notion:fetch script pulls structured content from Notion and rewrites local docs. Keep these rules in mind so the output matches your expectations:
- Filter criteria: Only pages where
StatusequalsReady to publishand theParent itemrelation is empty are treated as parent records. Pages that fail either check are skipped. - Sub-page grouping: Parents must link their language variants through the
Sub-itemrelation. Each linked child should setLanguagetoEnglish,Spanish, orPortuguese. Any other language values are ignored. - Element Type field drives layout:
Element Type = Pageexports markdown, regenerates frontmatter, rewrites remote images understatic/images/, and tracks compression savings for the summary.Element Type = Togglecreates a folder (plus_category_.jsonfor English) and increments the “section folders” counter.Element Type = Headingstores the heading for the nextPageentry’s sidebar metadata and increments the “title sections applied” counter.
- Summary counters: The totals printed at the end reflect the actions above. Zeros mean no matching work occurred (for example, no toggles, no headings, or no images to optimize).
- Translations: When a non-English child page is processed, its title is written to
i18n/<locale>/code.jsonusing the parent’s English title as the key. Ensure those files exist before running the script. - Slug and edit URL: Markdown frontmatter derives the slug and
custom_edit_urlfrom the parent title. Adjust the Notion title to change the generated path. - Safety checks: Missing
NOTION_API_KEYorDATABASE_IDcause the script to exit early after logging an error. Other runtime failures (such as image download issues) are logged and processing continues for remaining pages.
Prerequisites: Ensure you've fetched content using one of the methods in Content Setup.
Launch a local development server with live reloading:
bun devThis command opens your browser automatically and reflects changes immediately.
Full local setup from scratch:
# Clone repository
git clone https://github.com/digidem/comapeo-docs.git
cd comapeo-docs
# Install dependencies
bun i
# Fetch content from content branch (fast)
git fetch origin content
git checkout origin/content -- docs/ i18n/ static/images/
# Start development server
bun devCompile all content—including Markdown files fetched from Notion and integrated translations—into static assets by running:
bun build
The resulting files are placed in the build directory for deployment via any static hosting service.
Deployments use a checkout strategy:
- Checkout
mainbranch (code and scripts) - Overlay content files from
contentbranch (docs, i18n, images) - Build the site with merged content
- Deploy to hosting platform
This ensures deployments always use the latest code with the latest content.
The site automatically deploys to production at https://docs.comapeo.app via GitHub Actions when changes are pushed to the main branch. You can also trigger deployments manually:
Manual Deployment:
- Go to the GitHub repository
- Click Actions → Deploy to Production
- Click Run workflow on the
mainbranch
API Deployment:
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/dispatches \
-d '{"event_type":"deploy-production"}'What happens during deployment:
- Site is built using
bun run build - Static files are deployed to Cloudflare Pages
- Notion pages with "Staging" status are updated to "Published"
- "Date Published" is automatically set in Notion
Required GitHub Secrets:
CLOUDFLARE_API_TOKEN- Cloudflare API token for deploymentCLOUDFLARE_ACCOUNT_ID- Your Cloudflare account IDNOTION_API_KEY- Notion integration API keyDATABASE_ID- Notion database ID
You can still deploy to GitHub Pages using:
- Using SSH:
USE_SSH=true bun deploy
- Without SSH (using GitHub credentials):
GIT_USER=<Your GitHub username> bun deploy
This method builds the site and pushes to the gh-pages branch.
The project includes automated Notion status management workflows:
# Update translation status
bun run notionStatus:translation
# Move to draft status
bun run notionStatus:draft
# Publish content (sets published date)
bun run notionStatus:publish
# Production publishing (Staging → Published with date)
bun run notionStatus:publish-productionThese workflows automatically update page statuses in your Notion database and set published dates when content moves to "Published" status.
The site supports custom colors for Notion callouts (admonitions). To modify the color scheme:
- Open
src/css/custom.css - Find the "Custom Admonition Colors" section (around line 85)
- Modify the hex color values for any admonition type:
NOTE(gray Notion callouts): Currently#e5e4e2(platinum/silver)TIP(green Notion callouts): Currently#22c55e(green)INFO(blue Notion callouts): Currently#3b82f6(blue)WARNING(yellow Notion callouts): Currently#f59e0b(amber)DANGER(red Notion callouts): Currently#ef4444(red)CAUTION(orange Notion callouts): Currently#f97316(orange)
Example: To change NOTE admonitions to purple:
/* NOTE admonitions (gray callouts from Notion) */
.admonition--note,
.admonition-note,
.alert--secondary,
div[class*="admonition"][class*="note"] {
background-color: rgba(147, 51, 234, 0.1) !important;
border-left-color: #9333ea !important;
border-color: #9333ea !important;
}
/* Update the corresponding icon color */
.admonition-note .admonition-icon svg,
div[class*="admonition"][class*="note"] svg {
fill: #9333ea !important;
}Changes will be reflected immediately in development mode (bun dev).
The repository includes several automated workflows for content management:
Sync Notion Docs (sync-docs.yml)
- Trigger: Manual dispatch or repository dispatch
- Purpose: Fetches content from Notion and commits to
contentbranch - Target Branch:
content - Environment: Requires
NOTION_API_KEYandDATABASE_IDsecrets
Translate Docs (translate-docs.yml)
- Trigger: Manual dispatch or repository dispatch
- Purpose: Generates translations and commits to
contentbranch - Target Branch:
content - Environment: Requires
NOTION_API_KEY,DATABASE_ID,OPENAI_API_KEY
Fetch All Content for Testing (notion-fetch-test.yml)
- Trigger: Manual dispatch with optional force mode
- Purpose: Tests complete content fetch from Notion
- Target Branch:
content - Features: Retry logic, detailed statistics, content validation
Clean All Generated Content (clean-content.yml)
- Trigger: Manual dispatch with confirmation
- Purpose: Removes all generated content from
contentbranch - Target Branch:
content - Safety: Requires explicit "yes" confirmation
Deploy to Staging (deploy-staging.yml)
- Trigger: Push to
main, manual dispatch, or after content sync - Process: Checkout
main+ overlaycontent→ build → deploy to GitHub Pages - URL: https://digidem.github.io/comapeo-docs
Deploy to Production (deploy-production.yml)
- Trigger: Push to
mainor manual dispatch - Process: Checkout
main+ overlaycontent→ build → deploy to Cloudflare Pages - URL: https://docs.comapeo.app
- Develop a robust translation strategy to further enhance our multilingual support.
- Integrate GitHub Actions for continuous deployment and automated publishing.
- Refine the Notion-to-Markdown integration for more dynamic updates.