Automate Blog Writing with n8n: Full Workflow Guide
Publishing consistent, high-quality blog posts takes a lot of time and energy. This step-by-step guide shows you how to use an n8n workflow template to automate most of that work, from AI writing and image generation to internal linking and email delivery.
You will learn how each node in the workflow contributes to the final article, how it connects with tools like Google Sheets and Replicate, and how to keep the whole system optimized for SEO, quality, and reliability.
What you will learn in this guide
- How the n8n automated blog writer workflow is structured from start to finish
- What each key node does and how data flows between them
- How to generate AI-written sections, introductions, and conclusions in HTML
- How to automatically add internal and external links for SEO
- How to generate and embed a featured image with Replicate
- How to send the finished draft via Gmail for human review
- Best practices, troubleshooting tips, and ideas for scaling the template
Why automate blog writing with n8n?
An automated blog workflow in n8n lets you:
- Save time by removing repetitive writing and formatting tasks
- Keep a consistent publishing schedule across your blog
- Standardize structure, headings, and links for better SEO
- Free up your team to focus on strategy, promotion, and editing instead of drafting
When built carefully, automation does not replace editorial judgment. Instead, it creates a repeatable pipeline that produces solid first drafts you can refine and approve.
Concept overview: How the n8n blog writer template works
At a high level, the workflow turns a title and outline into a ready-to-review blog post. It does this by chaining together several types of nodes:
- Input and preparation – receive a title and outline, then structure them for processing
- Section writing – use an LLM to write each H2 section in HTML
- Assembly – combine all sections and generate an introduction and conclusion
- SEO enhancements – add internal links from Google Sheets and external references from a research tool
- Image generation – create a featured image with Replicate and embed it in the HTML
- Delivery – send the final draft via Gmail to an editor or publisher
Key capabilities of the workflow
- Splits an outline into individual H2 sections
- Writes each section with an AI model via a dedicated node
- Aggregates all sections into a single HTML article
- Generates an introduction and conclusion tailored to the content
- Adds contextual internal and external links for SEO and credibility
- Builds a custom image prompt, calls Replicate, and embeds the image
- Sends the finished HTML draft through Gmail for human review
Understanding the main nodes in the workflow
1. Execute Trigger and Code node – starting the workflow
The workflow usually starts with an Execute Workflow trigger that is called by another n8n workflow. That parent workflow passes in two key pieces of information:
- The blog post title
- The outline, typically a list of H2 headings separated by new lines
A Code node is used immediately after the trigger. Its job is to:
- Receive the raw title and headings
- Split the outline on line breaks
- Clean up whitespace and empty lines
- Convert the headings into a structured array for later nodes
This preparation step ensures that each H2 can be processed independently in a predictable way.
2. Split Out and Write Content nodes – generating sections
After the outline is structured, a Split Out node takes the array of headings and processes them one by one. For each heading, the workflow runs a Write Content AI node, typically configured with an LLM model.
Inside the Write Content node, you usually:
- Pass the current H2 heading as the main topic
- Include the full outline and title in the prompt for context
- Ask the model to write a focused section in HTML (for example, with <h2> and <p> tags)
- Specify tone, reading level, and instructions to avoid repetition
This pattern provides several benefits:
- Each section is written with the same tone and structure
- You can easily regenerate or tweak a single section without rewriting the whole post
- Debugging is simpler because each H2 is handled separately
3. Aggregate, Introduction, and Conclusion nodes – assembling the article
Once all sections are written, an Aggregate node collects them back into a single item. At this point, you have the core body of the article, but you still need a strong opening and closing.
Two additional AI nodes are used:
- Introduction node – generates a hook that explains what the reader will learn, usually 100-150 words
- Conclusion node – summarizes key points and includes a call to action, also around 100-150 words
Both nodes should be given:
- The title
- The complete outline
- The generated sections
That context helps the model write an introduction and conclusion that feel connected to the rest of the article.
4. Internal and external links nodes – adding SEO value
Next, the workflow enriches the content with links.
Internal links are handled by an Add Internal Links node that uses a Google Sheets node as a data source. The Google Sheet typically contains:
- Existing post titles
- URLs
- Target keywords or topics
The workflow looks up relevant posts and adds 1-2 contextual internal links per H2 section, but only where a natural anchor phrase already exists. This keeps the content readable and avoids forced links.
External links are generated by another AI or research agent that queries an external source tool, such as Perplexity. This node:
- Searches for 2-3 credible external references related to the topic
- Returns URLs and suggested anchor text
- Injects links into places where the anchor text already appears in the copy
These external citations support SEO and help build reader trust, as long as you verify the quality of the sources.
5. Image generation nodes – creating a featured image with Replicate
The workflow also generates a featured image. It starts with a Create Image Prompt node that builds a detailed text prompt based on the article topic. Common rules include:
- No people or faces
- No overlaid text
- Visual style that fits your brand or blog theme
This prompt is sent to Replicate via an HTTP node or a dedicated integration. Replicate generates an image and returns a URL. The workflow then:
- Retrieves the image URL
- Builds an <img> HTML block with alt text
- Inserts the image before the second H2 section in the article
Placing the image near the top of the content improves visual appeal and can boost click-through rates and social sharing.
6. Gmail node – delivering the draft for review
After the content, links, and image are in place, the workflow cleans the HTML. This often includes:
- Removing stray line breaks
- Normalizing spacing and tags
Finally, a Gmail node sends the compiled HTML as an email to an editor or publishing inbox. This acts as a human-in-the-loop step so someone can review, edit, and schedule the post before it goes live.
Step-by-step: Running the automated blog workflow in n8n
Step 1: Provide the title and outline
Start by triggering the workflow and passing in:
- The blog title
- An outline where each H2 is on its own line
The initial Code node will:
- Split the outline into an array of headings
- Remove empty lines and trim whitespace
- Prepare the data so each H2 can be processed separately later
Step 2: Generate AI-written sections
Next, the Split Out node iterates through each heading. For every H2:
- The current heading is passed into the Write Content AI node
- The node calls your chosen LLM with a prompt that includes the title and full outline
- The LLM returns a section of HTML, usually with a heading and several paragraphs
In your prompt, be explicit about:
- Desired length and structure
- Avoiding repetition across sections
- Maintaining a consistent tone and reading level
Step 3: Build the introduction and conclusion
After all sections are generated, they are reassembled with an Aggregate node. Then:
- An AI node creates a concise introduction (about 100-150 words) that previews what the article covers
- Another AI node writes a conclusion of similar length that recaps key points and includes a clear call to action
You can instruct the model to use specific hooks, such as questions or short stories, and to align the CTA with your business goals.
Step 4: Add internal and external links
With the full article text ready, the workflow enhances it for SEO.
For internal links:
- The workflow queries a Google Sheet that lists your existing posts
- It finds posts that match the topics of each section
- It adds 1-2 links per H2 only where a natural anchor phrase already exists
For external links:
- A research or AI node calls a tool like Perplexity to find reputable sources
- It selects 2-3 high-quality URLs relevant to the article
- It inserts links where the suggested anchor text already appears in the content
Both types of links are added carefully to avoid over-optimization or awkward phrasing.
Step 5: Generate and embed the featured image
Now the workflow focuses on visuals:
- The Create Image Prompt node builds a descriptive prompt based on the title and main topic
- The prompt is sent to Replicate, which returns an image URL
- An <img> tag is created with that URL and suitable alt text
- The tag is injected into the HTML just before the second H2 section
Make sure your prompt clearly states that the image should avoid people and text, and specify any style guidelines you prefer.
Step 6: Finalize the HTML and send via Gmail
In the final step:
- The workflow cleans up the HTML output to remove extra line breaks or unwanted formatting
- The compiled article, including introduction, sections, conclusion, links, and image, is passed to a Gmail node
- The Gmail node sends the draft to your editorial inbox or a specific reviewer
This built-in review step is essential for maintaining quality and editorial control, even in a highly automated pipeline.
Best practices for quality and SEO
- Use clear, descriptive headings and include your primary keyword in at least one H2
- Limit internal links to 1-2 per H2 and make sure the anchor text reads naturally
- Check external sources for credibility and avoid low-quality or spammy domains
- Keep introductions and conclusions concise, around 100-150 words for readability
- Always keep a human review step before publishing to catch errors and refine tone
Troubleshooting common issues
LLM output is repetitive or off-topic
If sections feel too similar or drift away from the main topic:
- Refine your prompts to reference the full outline and ask for unique examples in each section
- Specify a target reading level and tone
- Include explicit constraints about what the model should avoid repeating
Image generation fails in Replicate
If Replicate returns errors or no image:
- Check the prompt formatting and remove unsupported characters
- Verify that the aspect ratio and parameters are valid for the chosen model
- Confirm that the content does not violate model or platform restrictions
- Add retries and exponential backoff to your HTTP request nodes to handle temporary issues
Internal or external links do not fit the content
If a suggested link feels forced:
- Skip adding the link if there is no natural anchor text already present
- Avoid creating artificial phrases just to insert a link
- Manually review a sample of automated links to ensure they are contextually relevant
Security, privacy, and compliance considerations
When connecting n8n to third-party AI and image services, keep data protection in mind:
- Do not send sensitive or personally identifiable information in prompts
- Store API keys securely in n8n credentials instead of hard-coding them
- Use least-privilege access for all integrated services
- Log only non-sensitive metadata for auditing and monitoring
Optimization tips for performance and cost
- Cache responses for repeated prompts to reduce API calls and costs
- Use smaller, cheaper models for routine sections and reserve more powerful models for introductions and conclusions
- Document and version control your prompts and node configurations so you can iterate safely
- Keep a human-in-the-loop approval gate before publishing to avoid unreviewed AI hallucinations
When and how to scale this template
This n8n template works well for solo creators and content teams. You can extend it by:
- Adding scheduling nodes to publish on a fixed cadence
- Connecting directly to your CMS (WordPress, Ghost, or a headless CMS) to create drafts automatically
- Integrating analytics tools to track performance of published posts
- Expanding the image generator to create multiple sizes for social media cards and previews
Recap and next steps
With this n8n workflow, you can automate most of the blog creation process while keeping quality and control:
- AI writes the sections, introduction, and conclusion based on your outline
- Internal and external links are added for SEO and credibility
- Replicate generates a featured image that is embedded directly in the HTML
- The final draft is emailed via Gmail for human review and scheduling
By combining clear prompts, careful linking rules, and a mandatory editorial review, you can safely accelerate your content strategy without sacrificing standards.
Ready to try it? Clone the template, connect your APIs, and run a test post this week. If you want help tailoring the workflow to your CMS or editorial process, reach out to our team.
