SEO Blog Engine:拆解以 n8n 撰寫文章草稿的工作流
The SEO Blog Engine: A Teardown of the n8n Workflow That Writes My Drafts
作者拆解其以 n8n 運行的 SEO Blog Engine,説明工作流如何由關鍵詞生成可供編輯的文章草稿。流程以 0–10 評分懲罰關鍵詞堆砌,要求每個 H2 引用研究階段找到的小標題,並先驗證結構化 JSON 再轉成 Markdown;無依據主張比例由幾乎每隔一篇草稿出現降至幾乎為零。
The SEO Blog Engine: A Teardown of the n8n Workflow That Writes My Drafts
This is part of my build-in-public series on running LLM workflows in n8n in production. Everything here is from a real template I sell and support — the mistakes are mine, the fixes are tested.
The pipeline in 30 seconds
Keyword in → a research pass that pulls the top-ranking pages' subheadings → an outline node that must cite those subheadings → a draft node that writes section by section against a style contract → a schema-guard node that rejects malformed drafts → publish-ready Markdown out. No human touches the middle. The failures I want to talk about all lived in that middle, where nobody was watching.
Failure #1: the keyword-stuffing reflex
The first drafts read like 2012. The model had absorbed a decade of "SEO writing" and produced sentences like "this n8n automation workflow template helps you automate workflows with automation." Technically keyword-rich. Unreadable.
The fix was a readability penalty in the scoring rubric: every draft gets scored on a 0–10 scale where keyword stuffing and repeated phrases subtract points, and the draft only ships at 7+. The prompt didn't change much — the judge changed. Models optimize for whatever grades them; grade for prose, get prose.
Failure #2: the invented outline
The outline node had a fun habit: inventing H2 sections with no basis in anything — subtopics no ranking page covered, statistics cited to sources that didn't exist. It was creative writing wearing an SEO costume.
The fix: the outline must cite its sources line by line. Every H2 carries a reference to a real subheading from the research pass, and the draft node is forbidden from introducing new H2s — it can expand, never invent. Hallucination loves a blank canvas; give it a form to fill in instead. Unsupported-claim rate went from "every other draft" to effectively zero.
Failure #3: the formatting drift
Heading hierarchy drifted: H2s under H4s, code blocks inside list items, tables with mismatched columns. Everything looked fine in the preview pane and broke on import into the CMS. Death by a thousand small invalidities.
The fix was a schema guard before the Markdown render: the draft is produced as structured JSON (sections, headings, code blocks, tables as typed fields), validated against a schema, and only then rendered to Markdown. Rendering is the easy part; validating the structure before rendering is the whole game. (This is the same pattern as the retry-budget post in this series: constrain the output format, don't beg the model for it.)
The cost math
A full article runs ~25k input tokens (research context is the bulk) plus ~4k output: roughly $0.15–$0.25 per draft on GPT-4o-mini. The outline pass is the most expensive node and the one that saves the most human time — a bad outline means rewriting, which costs more than any token bill.
What I kept manual
Three things stay human: picking the headline from 5 candidates (taste, not tokens), the final edit pass (cutting 15–20% — the model overwrites), and internal links (which require knowing what I've actually written before). The workflow gets me from keyword to a draft worth editing in about 6 minutes. Editing is the job; the workflow just clears the runway.
I'm building AI Automation Lab — production-ready n8n workflow templates. The AI SEO Blog Engine is the full workflow from this article: the research pass, the citing outline node, the section-by-section drafter with the style contract, and the schema guard that keeps your CMS import clean. My open-source patterns live at github.com/zhp910318/n8n-ai-automation-lab.
來源:DEV Community · dev.to