The Content Scaling Problem
Most SaaS teams hit a wall around 50 blog posts. The editorial pipeline — ideation, drafting, editing, formatting, publishing — doesn't scale linearly. Each post requires the same human touch, and adding writers adds coordination overhead, not throughput.
AIKit's Auto Blog/SEO plugin solves this by connecting LLM providers directly to the EmDash content system. Instead of a human writing each post, the plugin generates Portable Text directly into the D1 database, creating publish-ready content in seconds.
Architecture: LLM → D1 → Live Site
The plugin works as a server-side Astro endpoint that:
1. **Accepts a prompt** — topic, keywords, tone, target length
2. **Calls an LLM** — configured via KV settings (provider, model, API key)
3. **Parses the response** — converts markdown into Sanity Portable Text JSON
4. **Inserts into D1** — creates the `ec_posts` row, revision, and SEO metadata in a single atomic flow
5. **Returns the URL** — the post is live immediately, no rebuild needed
```typescript
// The plugin's core publish flow (simplified)
const content = await callLLM(prompt, settings);
const blocks = markdownToPortableText(content);
const postId = generateId();
await db.prepare('INSERT INTO ec_posts (...) VALUES (...)').bind(postId, ...).run();
await db.prepare('INSERT INTO revisions (...) VALUES (...)').run();
```
The CMO Pipeline: Beyond One-Off Posts
What makes this powerful isn't the single-post generation — it's the queue-based pipeline built on top. The cron-driven CMO workflow:
- **Queue files** as JSON in `~/cmo/content/queue/` — each file is a post spec
- **`queue-publisher.py`** auto-picks, publishes, and archives
- **Auto-refill** — when the queue runs low, the agent generates 2+ new posts
- **Scheduled runs** — Mon/Wed/Fri at 6AM, 3 posts per week for SEO consistency
Results After 184 Published Posts
| Metric | Before (50 posts) | After (184 posts) |
|--------|-------------------|-------------------|
| Monthly organic visits | ~800 | ~4,200 |
| Blog posts/month | 8-10 (manual) | 40-60 (automated) |
| Cost per post | ~$150 (writer) | ~$0.50 (LLM tokens) |
| Publishing latency | 3-5 days | <2 minutes |
Key Takeaways
- The plugin's D1-native architecture means posts appear in `/llms.txt` and `/sitemap.xml` automatically — no rebuild, no cache flush
- LLM-generated content works best with structured prompts: clear headings, audience definition, keyword targets
- The Portable Text format is the key enabler — it separates content structure from rendering, so the same plugin can target any EmDash collection
- Set up the CMO pipeline once and it runs indefinitely — the agent handles refill, publish, and calendar management