The SEO Blog Engine: A Teardown of the n8n Workflow That Writes My Drafts
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…
The SEO Blog Engine: Dissecting the n8n Workflow Behind My Automated Drafts
This piece is part of my "build-in-public" series on deploying language model workflows in n8n for production use. Everything shared here comes from a genuine template that I sell and maintain; the errors are my own, but the solutions have been thoroughly tested. Below is a breakdown of the end-to-end workflow, from keywords to a ready-to-publish markdown file.
In roughly 30 seconds, the process works like this: you input a keyword, the system conducts a research phase to identify top-ranking pages, then an outline node generates a structured draft section by section, adhering to a defined style contract. A schema-guard node follows to filter out any malformed drafts, and finally, a publish-ready markdown file emerges. No human intervention occurs within the middle stages of this workflow.
Now, let's delve into the issues I encountered and how I resolved them:
**Failure #1: Keyword Stuffing Reflex**
The initial drafts fell flat, sounding like a 2012-era SEO piece. The model, having absorbed a decade's worth of SEO writing, produced sentences that were technically keyword-rich but utterly unreadable. The solution was to introduce a readability penalty within the scoring rubric: every draft is graded on a 0-10 scale, where keyword stuffing and repetitive phrases subtract points, and the draft only proceeds if it scores 7 or higher.
The prompt itself remained unchanged; it was the evaluation criteria that shifted. Models ultimately optimize for whatever grading system they're subjected to; hence, grading for prose quality yields more natural language output.
**Failure #2: The Invented Outline**
The outline node had an annoying habit of fabricating H2 sections without any factual basis—introducing topics that no ranking page covered, and citing sources that didn't exist. This resulted in creative writing masquerading as SEO content. To combat this, I mandated that the outline node must cite its sources line by line. Each H2 heading now references a real subheading from the research phase, preventing the node from introducing new H2s; it's allowed to expand upon existing ones instead.
This change drastically reduced the hallucination rate from nearly every second draft to effectively zero.
**Failure #3: Formatting Drift**
Another issue was the erratic formatting of the output. Headings sometimes appeared under incorrect hierarchy levels, code blocks ended up inside list items, and tables exhibited mismatched columns. The output appeared fine in the preview pane but broke when imported into the Content Management System (CMS). The remedy was to transform the draft into structured JSON before rendering, incorporating sections, headings, code blocks, and tables as typed fields.
Validation of this structured data against a predefined schema occurred prior to rendering as markdown, ensuring that only well-formed markdown files were produced. This process mirrors the retry-budget strategy discussed in a previous post in this series: by constraining the output format, we eliminate many potential issues upfront rather than relying on the model to correct them.
**Cost Analysis**
A complete article generates around 25,000 input tokens (mainly the research context) and approximately 4,000 output tokens. On average, this translates to a cost of $0.15–$0.25 per draft when using the GPT-4o-mini model. The most resource-intensive node is the outline creation, which often requires multiple iterations and thus incurs the highest cost. However, a well-crafted outline significantly reduces the need for manual rewriting, making it the most cost-effective step in the long run.
**Manual Interventions**
While the workflow automates most of the process, three tasks remain human-driven: selecting the headline from five candidate options (based on taste rather than token analysis), conducting the final edit pass (trimming about 15–20% of the text—areas where the model tends to over-compensate), and generating internal links, which demand prior knowledge of the article's content.
Overall, this workflow condenses the journey from keyword input to a draft worthy of editing down to approximately 6 minutes. The true labor continues post-generation, in the editing phase. My vision extends beyond this initial template; I'm developing AI Automation Lab—a repository of production-ready n8n workflow templates designed to streamline AI-assisted content creation.
The "AI SEO Blog Engine," detailed in this article, exemplifies the final product: it encompasses the research phase, the outline node with source citations, a section-by-section drafter enforcing a predefined style contract, and a schema guard ensuring seamless CMS imports. All these components are available openly on GitHub at github.com/zhp910318/n8n-ai-automation-lab.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.