WordPress SEO Meta Optimization with AI and Yoast - n8n Workflow

Automate WordPress SEO optimization by fetching sitemaps, generating optimized meta titles and descriptions using an OpenAI n8n workflow, and updating posts via the Yoast API. This n8n workflow saves hours of manual work.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • SEO specialists and digital marketers needing bulk optimization.

  • Webmasters managing large WordPress sites who use Yoast SEO.

  • Technical users looking for advanced n8n templates integrating AI and HTTP requests.

  • Developers who want to automate repetitive SEO tasks using n8n and an OpenAI n8n node.

Overview

Manually writing compelling meta descriptions and titles for hundreds of pages is extremely time-consuming. This powerful n8n workflow solves this by fully automating the process. It first uses an HTTP request to fetch the target website's sitemap, identifying all pages that need optimization. It then feeds the content of these pages into an OpenAI n8n node, leveraging large language models to generate highly relevant and keyword-rich SEO metadata. Finally, it uses another HTTP request to update the WordPress posts directly (likely targeting the Yoast SEO API). This entire n8n automation includes robust error handling and reporting, logging results to Google Sheets and sending a summary email via Gmail, ensuring you maintain complete visibility over the bulk updates.

How it Works

This comprehensive n8n workflow operates in several distinct stages:


  1. Trigger and Initialization: The n8n trigger can be activated either manually or via a Webhook, typically passing the target domain as a parameter (?pag=example.com). Initial code nodes like UA Rotativo and OPTIONS prepare the environment, potentially setting up rotating User Agents and global configuration variables.

  2. Sitemap Retrieval: The workflow utilizes the Maping urls n8n node (HTTP Request) to download the site's sitemap XML. Error paths (Sitemap Error) ensure the n8n workflow handles inaccessible sitemaps gracefully.

  3. Page Iteration: The Iterar Páginas n8n node (Split In Batches) splits the list of URLs retrieved from the sitemap, initiating the optimization loop for each individual page.

  4. AI SEO Generation: Inside the loop, the page content is processed and fed into the meta descr and title gen OpenAI n8n node. This AI agent generates the optimized meta desc and title based on the content.

  5. WordPress Update: The results are immediately passed to the meta desc and title SEO YOAST n8n node (HTTP Request), which performs an API call to the WordPress installation (presumably targeting a REST endpoint or Yoast API) to push the newly generated metadata live.

  6. Reporting and Notification: After the main optimization loop, the SEO Result code node formats the outcome (success/failure per URL). The results are appended to a Google Sheet via the Append row in sheet n8n node for tracking. Finally, the workflow uses a second OpenAI n8n node (Text email) to generate a professional summary, which is sent via the Send a message Gmail n8n node, completing the automated reporting cycle. This entire n8n workflow is designed for efficiency and scale.

Installation Guide

To deploy this n8n workflow template, follow these steps:


  1. Import: Copy the provided JSON code and paste it into your n8n instance using the 'New' -> 'Import from JSON' feature.

  2. Credentials Setup:

OpenAI: Set up credentials for the OpenAI n8n node (meta descr and title gen and Text email). You will need a valid OpenAI API key.
WordPress/Yoast: Configure the credentials for the HTTP Request n8n node (meta desc and title SEO YOAST). This typically requires authentication (Basic Auth or API Key) suitable for updating WordPress posts via the API.
Google Sheets: Set up Google Sheets credentials for the Append row in sheet n8n node, granting access to the spreadsheet where logs will be stored.
Gmail: Configure Gmail credentials for the Send a message n8n node for sending reports.

  1. Webhook Configuration: If using the Webhook n8n trigger, ensure you activate the workflow and note the URL. Test by appending the required ?pag=yourdomain.com query parameter.

  2. Testing: Execute the n8n workflow and verify that the sitemap is fetched, AI generates data correctly, and updates are reflected on the target WordPress site.

Node Details

Webhook (n8n trigger): Used to start the n8n workflow on demand, passing the target site URL (e.g., ?pag=example.com) to initiate the SEO process.
UA Rotativo (Code n8n node): A custom scripting step designed to set a rotating User Agent header, crucial for robust web scraping and sitemap fetching via HTTP Request n8n nodes.
Maping urls & HTTP Request1 (HTTP Request n8n node): Responsible for fetching and initial parsing of the sitemap XML from the target domain, crucial for obtaining the list of URLs to optimize.
Iterar Páginas (Split In Batches n8n node): A core flow control n8n node that separates the list of URLs into individual items, allowing the subsequent steps (AI generation) to process them one by one.
meta descr and title gen (OpenAI n8n node): The core intelligence of the n8n workflow. It uses a Langchain integration with OpenAI to generate high-quality, SEO-optimized meta titles and descriptions based on the input page content.
meta desc and title SEO YOAST (HTTP Request n8n node): This critical step performs the actual update, sending the AI-generated data to the WordPress site's API to update the Yoast SEO fields for the corresponding page.
Append row in sheet (Google Sheets n8n node): Logs all results, including the URL, generated metadata, and update status, providing a historical record of the n8n workflow execution.
Text email (OpenAI n8n node) & Send a message (Gmail n8n node): Generates a final summary report using AI and emails it to stakeholders, confirming the successful completion of the bulk SEO updates enabled by this n8n template.

Related n8n Workflows

Paid

Nodes: 14 Nodes
Updated: December 26 2025
View all
Created by
Oriol Seguí
Oriol Seguí

Completion of a higher degree on the way to university (computer engineering)

Featured*