Over the past month I built an automated content pipeline that generates 2500+ word SEO articles, creates images, and publishes to WordPress — all for free. Here is exactly how it works, what it cost, and the real Rank Math scores it achieves.
What the Pipeline Does
The pipeline runs daily and performs these steps:
- Research: Queries SearXNG for trending topics in AI/automation niches
- Generation: Uses OpenRouter’s gpt-oss-120b:free model to write 2500+ word articles in two parts (Part A + Part B concatenated)
- SEO Structure: Injects Rank Math TOC shortcode, FAQ blocks, internal/external links, anchor-linked headings
- Images: Generates hero image via ComfyUI (juggernaut model), uploads 4 inline images
- Publishing: Creates WordPress post, sets Rank Math meta, uploads images, publishes if score ≥ 81
- Social: Posts to X and LinkedIn (when bridge is running)
Pipeline Architecture

The pipeline is a single Python script (~1100 lines) running in WSL, not a complex n8n workflow. n8n handles image generation and has webhooks for WordPress publishing, but the orchestration is local Python. This keeps it simple and debuggable.
The n8n Workflows
n8n runs on Docker at 172.30.0.10:5678 with 100+ workflows. Three are critical to the pipeline:

- ComfyUI Image Gen (WDiBQ0A8n49Gd7MO): Receives a prompt, calls ComfyUI API on Windows host, returns the image URL. ~20s runtime.
- WP Publish (0RdzR0MKwrQtXIk9): Creates WordPress post, sets Rank Math meta, handles media upload via upload-media.php. Auth via app password.
- SEO Article Writer (mQNioKkECklJd24i): Generates 2500+ word articles via groq webhook. ~75s runtime.
Cost Comparison: Manual vs Automated

| Method | Cost/article | Time/article | SEO Score |
|---|---|---|---|
| Manual writer (Fiverr) | $50 | 3-4 hours | Varies |
| ChatGPT API (gpt-4o) | $8 | 5 min | ~70 |
| OpenRouter (gpt-oss-120b:free) | $0 | 5 min | ~85 |
| This pipeline | $0 | ~6 min | 85-91 |
SEO Score Evolution

We iterated from 55 to 91 by fixing specific Rank Math score factors:
- v2: Added TOC (table of contents) → +10 points
- v3: Added inline images → +6 points
- v4: Added keyword in slug, proper TOC classes → +10 points
- v5: Fixed heading keyword stuffing → +5 points
- v6: Added image alt text → +5 points
- v7: Removed hero image duplication, fixed TOC to shortcode → stabilized at 85
Key Technical Decisions
Two-Part Generation
Single API calls cap at ~2000 tokens output. We split generation into Part A (intro + setup) and Part B (advanced + troubleshooting + FAQ), concatenating them. This reliably produces 2500+ rendered words.
Focus Keyword in URL
Rank Math penalizes slugs that don’t contain the focus keyword. We build the slug from the focus keyword (e.g., “best-free-ai-tools”) not the full title. Short, keyword-rich URLs score higher.
Rank Math TOC Shortcode
Raw HTML TOC divs don’t collapse. Using the [rank_math_table_of_contents] shortcode gives you the native Rank Math JS with collapsible sections and proper styling.
What Still Needs Work
- Social posting: The bridge at 172.30.0.6:9121 is down. Need to route through n8n webhooks instead.
- Image alt text: Using focus keyword as alt — could be more descriptive.
- Topic selection: Currently random from 10 niches. Should use actual search volume data.
- Internal linking: Links to slugs that may not exist yet. Need to check post existence first.
Source Code
The pipeline script is at /workspace/scripts/auto_content_pipeline.py (~1121 lines). Key functions:
generate_article(title, focus_keyword) # Two-part OpenRouter generation
inject_seo_structure(content, title, kw) # TOC, links, FAQ
publish_wordpress(title, content, kw, ...) # REST API + Rank Math meta
verify_score(post_id, focus_keyword) # Parse actual post content
For the full setup — n8n Docker Compose, WordPress config, ComfyUI API — check the infrastructure docs in /workspace/infra/.
[rank_math_table_of_contents]
