ChatGPT创意写作AI 评分 · 73/100AI 辅助编辑·未发现明显提示词注入风险n8n.io

n8n 自动 SEO 博客发布:从 Google Sheets 到 WordPress

输入 Google Sheets 行数据 → AI 研究规划 → 生成内嵌图片 → 撰写 HTML 文章 → 发布至 WordPress 并设置头图

有一点经验步骤流程提示词贴士
给谁
需要批量发布 SEO 优化博客的内容创作者、代理商或企业运营者
你会得到
在 WordPress 自动发布包含内嵌图片的完整 HTML 文章,并设置特色头图
你需要
n8n · perplexity · google-sheets · wordpress · cloudinary

硬约束

需要 n8n 实例、WordPress REST API 凭证、OpenAI API 密钥、Perplexity API 密钥、Google Sheets OAuth2 访问权限,以及 Cloudinary 无签名上传预设。可选 Pexels API 密钥用于库存头图。工作流按定时触发,每次处理一行未发布数据。

他们做了什么

模板作者 lukaszb 在 n8n 上构建了一个 43 节点的自动化工作流,从 Google Sheets 读取未发布的博客主题,通过 AI Agent 结合 Perplexity 研究生成内容规划,批量生成内嵌图片并上传 Cloudinary,撰写语义 HTML 文章,最终发布到 WordPress 并设置特色头图。

效果如何

作者声称该系统可'在几分钟内发布专业文章',实现'端到端自动化',内容针对 SEO 和 RAO(AI 驱动搜索)优化,并通过段落间嵌入图片提升阅读体验。这些效果声明来自作者自述,未经本站实测验证。

值得知道

工作流中存在多处拼写不一致(如节点名 'Article wrtiter'、字段名 'descritption_image'、'wordpres website url'),用户需按原文精确匹配。Pexels 库存头图路径默认禁用,AI 头图路径使用 gpt-image-1(1536x1024)。Structured Output Parser 节点配置了 autoFix 以加固 JSON 输出。OpenAI Chat Model4 节点参数显示 gpt-5-mini,但该模型可用性需用户自行确认。本站未执行该工作流,reproduction 状态为 not_tested。

n8n 工作流模板

结构已检查 · 未实际运行

下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。

配置与测试清单

需要绑定的凭证

  • OpenAI Chat Model 节点:绑定OpenAI API 凭证。
  • OpenAI Chat Model4 节点:绑定OpenAI API 凭证。
  • Generate an image1 节点:绑定Google Gemini/PaLM API 凭证。
  • OpenAI Chat Model1 节点:绑定OpenAI API 凭证。
  • Message a model in Perplexity 节点:绑定Perplexity API 凭证。
  • Get data databse 节点:绑定Google Sheets OAuth2 凭证。
  • Set Image on Wordpress Post1 节点:绑定wordpressApi 凭证。
  • WordPress excerpt add1 节点:绑定wordpressApi 凭证。
  • WordPress excerpt add1 节点:绑定HTTP Header Auth 凭证。
  • OpenAI 4.1 mini4 节点:绑定OpenAI API 凭证。
  • Append or update row in sheet 节点:绑定Google Sheets OAuth2 凭证。
  • Create a post 节点:绑定wordpressApi 凭证。
  • upload image to wordpress 节点:绑定wordpressApi 凭证。
  • Get Image from Pexels 节点:绑定HTTP Header Auth 凭证。
  • OpenAI 4.1 mini5 节点:绑定OpenAI API 凭证。
  • Generate an image 节点:绑定OpenAI API 凭证。
  • Set Image on Wordpress Post2 节点:绑定wordpressApi 凭证。
  • upload image to wordpress1 节点:绑定wordpressApi 凭证。
  • Append or update row in sheet1 节点:绑定Google Sheets OAuth2 凭证。
  • Generate an image2 节点:绑定OpenAI API 凭证。
  • Generate an image3 节点:绑定Google Gemini/PaLM API 凭证。

需要替换的配置

  • 源模板来自 n8n 公开库 #7965(约 43 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
  • Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。

测试输入与预期结果

  • 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
  • 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。

模板处理说明

  • 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
  • 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。

模板获取日期: 2026-10-24

步骤

  1. 设置输入与触发器

    在 n8n 中配置 Schedule Trigger 定时运行。添加 Google Sheets 节点读取表格(如 Arkusz1),筛选 `created` 为空的行,并用 Limit 节点限制每次仅处理一行。在 Set 节点中填入工作变量:博客标题与描述来自 Sheet 行,Cloudinary 云名称、品牌简介(b/c_information)、WordPress 网址等静态配置也需在此设置,避免硬编码到其他节点。

  2. AI 内容规划与研究

    Content planer(Agent 节点)接收标题、描述和品牌简介。它调用 Perplexity 工具进行研究,获取可信来源与统计信息,并检查 Google Sheets 历史避免重复主题。输出严格 JSON 格式:title、slug、meta、excerpt、description、image_prompts、sources。Structured Output Parser 强制校验该结构,autoFix 已启用。

    运行提示词 · 来源原文。Content planer 节点的 user prompt 字段

    =Blog article title: {{ $json.blog_title }}
    Short descritpion: {{ $json.blog_s_descritpion }}
    
    Company/brand information: {{ $json['b/c_information'] }}

    运行提示词 · 来源原文。Content planer 节点的 systemMessage 字段

    =You are an AI Content Strategist specializing in creating unique, SEO-optimized, and RAO-friendly long-form blog content ideas.
    
    Your workflow is as follows:
    
    Read the brand brief provided in the user prompt and follow it strictly.
    
    Check history: Use the google_sheet tool to retrieve all previously generated topics and avoid duplication.
    
    Research: Use the perplexity tool to gather additional supporting information, statistics, and reputable sources. Include 2–3 source links in the final outline where relevant.
    
    Create a complete content plan for a blog article that is:
    
    Unique, evergreen, and aligned with the brand strategy.
    
    Valuable for both SEO and RAO (AI-driven search).
    
    Well-structured and highly detailed, showing what should be written in each section.
    
    Output format: Return only a single JSON object with the following fields:
    
    {
      "title": "Clear, keyword-rich title (max. 60 chars)",
      "slug": "url-friendly-lowercase-hyphenated",
      "meta": "Concise meta description (max. 160 chars, includes keywords)",
      "keywords": ["keyword1", "keyword2", "keyword3", "keyword4", "keyword5"],
      "excerpt": "1–2 sentence factual and engaging summary",
      "description ": "full description about blog, with all necessary information, and link to source"
      ],
      "image_prompts": [
        "Prompt for first relevant image (describe scene, style, purpose)",
        "Prompt for second relevant image (describe scene, style, purpose)"
      ],
      "sources": [
        "https://source-link-1.com",
        "https://source-link-2.com"
      ]
    }
    
    
    
    Rules:
    
    Never write the full article text. Only provide the plan and structure.
    
    Sources must be real, credible, and derived from Perplexity.
    
    Image prompts must describe visuals that add value inside the article (not generic).
    
    Always ensure topic originality vs. history from Google Sheets.
    
    Maintain factual, professional, and SEO-focused tone.
  3. 生成内嵌图片并上传

    Split Out 节点将 image_prompts 数组拆分为单项。Loop Over Items 控制循环处理:每项使用 Generate an image2(OpenAI Image,gpt-image-1)生成图片,经 HTTP Request 上传至 Cloudinary(URL: `https://api.cloudinary.com/v1_1/{{ cloudinary account name }}/image/upload`,preset: `unsigned_upload`)。Set Output Image 保存返回的 image_url 和原始 prompt。Aggregate 聚合为 images 数组供写作节点使用。Gemini 路径(Generate an image1)默认禁用。

    运行提示词 · 来源原文。Generate an image2 节点的 prompt 字段

    =generate a image {{ $json['output.image_prompts'] }}
  4. 撰写 HTML 文章正文

    Article wrtiter(Chain 节点)接收规划字段、品牌简介和 images 数组,输出纯 HTML 正文(非 JSON、非 Markdown)。系统提示强制要求语义 HTML5、懒加载图片、无 h1、可选目录导航、引用块、TL;DR 和行动号召。

    运行提示词 · 来源原文。Article wrtiter 节点的 text 字段(user prompt)

    =Create me a full ready conetnt  to article in my blog .
    
    Title of article: {{ $('Content planer').item.json.output.title }}
    Description: {{ $('Content planer').item.json.output['description '] }};
    Optional sources: {{ $('Content planer').item.json.output.sources }}.
    
    Avalible images urls to add betwen text:
    Image 1:
    -url: {{ $json.images[0].image_url }}
    -description:{{ $json.images[0].descritption_image }}
    Image 2:
    -url:{{ $json.images[1].image_url }}
    -description: {{ $json.images[1].descritption_image }}
    
    Company/brand information where and for who you writnig too:
    {{ $('Set input data/credintenials').item.json['b/c_information'] }}
    
    Give me the html as a raw multiline text. Do not format it as JSON, do not escape newlines.

    运行提示词 · 来源原文。Article wrtiter 节点的 messages.messageValues[0].message 字段(system prompt)

    =You are a Long-Form Blog Writer. Produce a complete, publication-ready HTML article body using the brand brief, the approved content plan (outline), and the provided images.
    
    Hard rules (STRICT):
    
    Output only HTML. No JSON, no Markdown, no comments, no extra prose.
    
    Do not include title, slug, excerpt, meta, or any front matter.
    
    Follow the plan_json.outline for structure and coverage.
    
    Respect the brand tone from brand_brief. Be precise, actionable, and factual.
    
    Target word count within ±10% of target_word_count.
    
    HTML requirements:
    
    Use semantic HTML5 only: <article>, <section>, <h2>–<h3>, <p>, <ul>, <ol>, <blockquote>, <figure>, <img>, <figcaption>, <nav>, <aside>, <footer>.
    
    No <h1> (title is handled elsewhere). Start main sections with <h2>.
    
    Optional Table of Contents as <nav> with anchor links to sections in the outline.
    
    Insert images as <figure> elements:
    
    Use loading="lazy" for all images.
    
    Provide descriptive alt text (keyword-aware, no stuffing).
    
    If an image has place_after_section_id, insert it immediately after that section; otherwise choose the most relevant place.
    
    Include 1–2 short pull quotes via <blockquote>.
    
    Add a concise TL;DR in an <aside> near the top (no title/excerpt duplication).
    
    End with a short actionable conclusion and, if appropriate, a brand-aligned CTA inside <footer>.
    
    Factuality & SEO/RAO:
    
    Use definitions and scannable sentences that AI systems can extract.
    
    If the outline references sources, link them with <a href="..."> (no bibliography header).
    
    Failure conditions:
    
    If required inputs are missing, produce an empty <article></article> (no explanations).
  5. 发布至 WordPress

    Create a post 节点使用 WordPress 凭证创建文章:title 和 slug 来自规划输出,content 为 writer 的 HTML text,status 设为 publish。随后 WordPress excerpt add1(HTTP Request)更新文章摘要为规划中的 excerpt。

  6. 生成头图并标记完成

    默认启用 AI 头图路径:Write query too image AI generator 将标题和摘要转为 20-40 词的图片生成提示词,Generate an image(OpenAI, gpt-image-1, 1536x1024)生成图片,upload image to wordpress1 上传为媒体,Set Image on Wordpress Post2 将 featured_media 绑定到文章。最后 Append or update row in sheet1 将 Google Sheets 的 created 设为 True。 可选 Pexels 库存路径(默认禁用):Write query too pexels 提取 1-3 个视觉名词,搜索并下载图片后上传。两条路径只能启用其一,避免冲突。

    运行提示词 · 来源原文。Write query too image AI generator 节点的 text 字段

    =Title: {{ $('Content planer').item.json.output.title }}
    Description:{{ $json.excerpt.raw }}
    
    Convert the above title into the single best promopt to AI image genrator like midjourney or Leonardo AI

    运行提示词 · 来源原文。Write query too image AI generator 节点的 messages.messageValues[0].message 字段(system prompt)

    =You are an expert prompt engineer specialized in creating header images for blog articles.
    Your ONLY task is to transform a blog article’s title and excerpt into the best possible image generation prompt.
    
    Rules:
    
    The image must serve as a header illustration for a blog article.
    
    Always use concrete visual nouns and scenes that can be illustrated.
    
    Focus on places, objects, actions, or people that match the article’s theme.
    
    Add descriptive context:
    
    Mood (professional, minimalist, cinematic, modern, vintage, futuristic, etc.)
    
    Style (digital art, illustration, flat design, cinematic photo, infographic, etc.)
    
    Setting or environment (city, office, nature, abstract background, etc.)
    
    Keep prompts between 20–40 words.
    
    Always in English.
    
    Output format:
    
    Return only one final image prompt in plain text.
    
    Do not add explanations, quotes, markdown, or JSON.
    
    Fallback:
    
    If the content is abstract, create a conceptual illustration prompt (e.g. "abstract geometric shapes, futuristic digital art, minimal composition").

    运行提示词 · 来源原文。Write query too pexels 节点的 text 字段(Pexels 路径,默认禁用)

    =Title: {{ $('Content planer').item.json.output.title }}
    Description:{{ $json.excerpt.raw }}
    
    Convert the above title into the single best Pexels keyword phrase following every instruction in the system prompt.  
    Return ONLY the keyword phrase.

    运行提示词 · 来源原文。Write query too pexels 节点的 messages.messageValues[0].message 字段(system prompt,Pexels 路径,默认禁用)

    =You are an expert prompt‑engine and image curator.  
    Your ONLY task is to reduce a single blog‑post titleto the **best possible Pexels keyword phrase**.  
    Follow these rules exactly:
    
    1.Choose 1‑3 concrete visual nouns** that can actually appear in a photo (e.g. [EXAMPLES OF KEYWORDS LIKE "LONDON", "ROBOT","NATURE"]). Remove abstract terms like ‘outlook’, ‘sentiment’, ‘future’.
    
    2.Keep it SHORT: 
       • Maximum 3 words total.  
       • Prefer single‑ or double‑word phrases when possible.  
       • No adjectives such as ‘beautiful’, ‘cool’, ‘nice’.
    
    3. English only
    
    4.Output format 
       • Return **only** the keyword phrase, in plain text, no quotes, no commas, no additional words.  
       
    5. Fallback
       • If the title is too abstract, return one of:  
         [SAFE QUERRY SEARCH]
    
    Never add orientation, size, JSON, markdown, or explanations.  
    Return exactly one line containing only the keywords.

可复制提示词

搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限

这一段是提示词,页面不会在这里插入广告。

你是一个 n8n 工作流搭建助手。用户想复现一个从 Google Sheets 自动发布 SEO 博客到 WordPress 的模板。请先确认用户已准备好:WordPress REST API 凭证、OpenAI API 密钥、Perplexity API 密钥、Google Sheets OAuth2 访问、Cloudinary 无签名上传预设(unsigned_upload)。然后按步骤指导导入 workflow JSON、配置凭证、填写 Set 节点变量,并提醒只启用一条头图路径(AI 或 Pexels)。

需要 n8n 实例及多个 API 密钥;首次运行建议手动触发验证

来源

Automated SEO blog publishing with WordPress, OpenAI & Perplexity · lukaszb · n8n.io · 2025-08-27

留言与反馈

试过这个方法吗?分享效果、遇到的问题或改进建议。留言审核后公开,请勿填写敏感信息。

正在加载…

    相关用例