|
| 1 | +--- |
| 2 | +name: converting-notion-to-docusaurus-blog |
| 3 | +description: Use when converting a Notion markdown export to a Docusaurus blog post for the dbt docs site, or when given a path to a Notion export folder/file. |
| 4 | +--- |
| 5 | + |
| 6 | +# Converting Notion Exports to Docusaurus Blog Posts |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +Automates conversion of Notion markdown exports into properly formatted Docusaurus blog posts for docs.getdbt.com. Handles frontmatter generation, image processing, content cleanup, and file organization. |
| 11 | + |
| 12 | +## When to Use |
| 13 | + |
| 14 | +- User provides a path to a Notion markdown export |
| 15 | +- User mentions converting Notion content to a blog post |
| 16 | +- User has exported content from Notion for the dbt developer blog |
| 17 | + |
| 18 | +## Workflow |
| 19 | + |
| 20 | +### 1. Read Notion Export |
| 21 | + |
| 22 | +Parse the markdown file and locate the accompanying image folder (same name as the .md file, without the hash suffix). |
| 23 | + |
| 24 | +### 2. Extract Metadata |
| 25 | + |
| 26 | +From the Notion export, extract: |
| 27 | +- **Title**: The H1 heading |
| 28 | +- **Owner**: Maps to author lookup |
| 29 | +- Remove the metadata block (Status, Owner, Created time) from output |
| 30 | + |
| 31 | +### 3. Look Up Author |
| 32 | + |
| 33 | +Search `website/blog/authors.yml` for a matching name from the Owner field. |
| 34 | + |
| 35 | +**If not found**, prompt user: |
| 36 | +``` |
| 37 | +Author "[Name]" not found in authors.yml. |
| 38 | +
|
| 39 | +How would you like to proceed? |
| 40 | +1. Enter details now (name, title, photo URL, LinkedIn) |
| 41 | +2. Scaffold empty entry to fill in manually later |
| 42 | +``` |
| 43 | + |
| 44 | +Option 2 creates: |
| 45 | +```yaml |
| 46 | +firstname_lastname: |
| 47 | + name: Full Name |
| 48 | + title: "" # TODO |
| 49 | + image_url: /img/blog/authors/firstname-lastname.png # TODO |
| 50 | + socials: |
| 51 | + linkedin: "" # TODO |
| 52 | + page: true |
| 53 | +``` |
| 54 | +
|
| 55 | +### 4. Prompt for Confirmations |
| 56 | +
|
| 57 | +- **Date**: Default to today + 2 days (YYYY-MM-DD) |
| 58 | +- **Slug**: Suggest SEO-optimized version (short, keywords only, drop filler words) |
| 59 | +- **Description**: Find a compelling sentence from within the article that captures the key value or insight - not just the opening line |
| 60 | +- **Tag**: Select the most appropriate tag based on content (see Tag Selection below) |
| 61 | +- **End of content**: Confirm where the publishable content ends (remove trailing internal notes) |
| 62 | +
|
| 63 | +**Slug guidelines**: Keep 2-4 words, include primary keywords, drop "introducing", "a", "the", "how to". |
| 64 | +- "Introducing dbt agent skills" → `dbt-agent-skills` |
| 65 | +- "Getting Started with git Branching Strategies" → `git-branching-strategies-dbt` |
| 66 | + |
| 67 | +**Tag selection**: Check `website/blog/categories.yml` for available tags and their descriptions. Select the most appropriate tag based on the post content. Fall back to `analytics craft` only if no other tag fits. |
| 68 | + |
| 69 | +### 5. Process Images |
| 70 | + |
| 71 | +For each image in the Notion export folder: |
| 72 | +1. Analyze the image to generate a semantic filename (e.g., `skills-mcp-diagram.png` not `74cb2aed-fe53-481b-89d0-eefd0054e0c2.png`) |
| 73 | +2. Generate alt text for accessibility |
| 74 | +3. Copy to `website/static/img/blog/YYYY-MM-DD-slug/` |
| 75 | + |
| 76 | +### 6. Copy Original File |
| 77 | + |
| 78 | +Copy the Notion markdown file to `website/blog/YYYY-MM-DD-slug.md` first. This establishes the baseline for git diffs. |
| 79 | + |
| 80 | +### 7. Apply Transformations as Edits |
| 81 | + |
| 82 | +Apply transformation rules (see below) as individual edits to the copied file. This makes changes visible in git diff, allowing review of exactly what was modified. |
| 83 | + |
| 84 | +### 8. Spellcheck Pass |
| 85 | + |
| 86 | +Run a spellcheck on the content and fix any typos or spelling errors. Be careful to preserve technical terms, product names (dbt, MetricFlow, BigQuery), and intentional stylistic choices. |
| 87 | + |
| 88 | +### 9. Report Results |
| 89 | + |
| 90 | +Summarize: files created, images processed, spelling corrections made, any TODO items (e.g., incomplete author entry). |
| 91 | + |
| 92 | +## Transformation Rules |
| 93 | + |
| 94 | +### Frontmatter |
| 95 | + |
| 96 | +Generate YAML frontmatter: |
| 97 | +```yaml |
| 98 | +--- |
| 99 | +title: "Title from H1" |
| 100 | +description: "A compelling sentence from the article that captures the key value or insight" |
| 101 | +slug: seo-optimized-slug |
| 102 | +
|
| 103 | +authors: [author_slug] |
| 104 | +
|
| 105 | +tags: [appropriate-tag] |
| 106 | +hide_table_of_contents: false |
| 107 | +
|
| 108 | +date: YYYY-MM-DD |
| 109 | +is_featured: true |
| 110 | +--- |
| 111 | +``` |
| 112 | + |
| 113 | +### Images |
| 114 | + |
| 115 | +| Notion | Docusaurus | |
| 116 | +|--------|------------| |
| 117 | +| `` | `<Lightbox src="/img/blog/YYYY-MM-DD-slug/semantic-name.png" width="85%" alt="generated alt text" />` | |
| 118 | +| Image with caption on next line | Merge caption into `title` attribute | |
| 119 | + |
| 120 | +### Content Cleanup |
| 121 | + |
| 122 | +| Pattern | Action | |
| 123 | +|---------|--------| |
| 124 | +| H1 title | Remove (comes from frontmatter) | |
| 125 | +| Status/Owner/Created time block | Remove | |
| 126 | +| Trailing sections after conclusion | Remove (internal notes) | |
| 127 | +| Code blocks with language `markdown` | Change to `bash` if shell commands | |
| 128 | +| Notion callouts (`> **Note**`) | Convert to `:::note` admonitions | |
| 129 | +| URL-encoded paths (`%20`) | Decode | |
| 130 | +| asterisks for emphasis (`*emphasised* content`) | Replace with underscores (`_emphasised_ content`) | |
| 131 | +| Internal Notion links (`notion.so`, `notion.site`) | Flag for review - replace with public resource links | |
| 132 | +| Absolute docs site links (`https://docs.getdbt.com/...`) | Convert to relative paths (`/docs/...`, `/reference/...`) | |
| 133 | + |
| 134 | +### Truncate Marker |
| 135 | + |
| 136 | +Insert `<!-- truncate -->` after the introduction (1-3 paragraphs, ~150-300 words) and before the first `##` heading. |
| 137 | + |
| 138 | +## Quick Reference |
| 139 | + |
| 140 | +``` |
| 141 | +Notion Export: |
| 142 | + my-post abc123.md |
| 143 | + my-post abc123/ |
| 144 | + image.png |
| 145 | + image 1.png |
| 146 | + |
| 147 | +Step 1 - Copy original: |
| 148 | + website/blog/YYYY-MM-DD-slug.md (raw Notion content) |
| 149 | + |
| 150 | +Step 2 - Apply edits (diffable): |
| 151 | + website/blog/YYYY-MM-DD-slug.md (transformed) |
| 152 | + website/static/img/blog/YYYY-MM-DD-slug/ |
| 153 | + semantic-name.png |
| 154 | + another-semantic-name.png |
| 155 | +``` |
0 commit comments