8
n8n 中文网amn8n.com

从Google Sheets生成SEO锚文本

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 Code, Filter, GoogleSheets, SplitInBatches, Agent 等节点。 使用Claude 4 Sonnet从Google Sheets生成SEO锚文本

前置要求
  • Google Sheets API 凭证
  • Anthropic API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "393ca9e36a1f81b0f643c72792946a5fe5e49eb4864181ba4032e5a408278263"
  },
  "nodes": [
    {
      "id": "8c2cca9f-cd91-4afc-8c2a-dbfb79b64b56",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1792,
        208
      ],
      "webhookId": "181a1719-6394-4157-98ed-3a7a48b23a0a",
      "parameters": {
        "mode": "webhook",
        "public": true,
        "options": {
          "responseMode": "responseNode"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "6d70bc94-52aa-4ac6-b94e-aca33559f7d0",
      "name": "筛选",
      "type": "n8n-nodes-base.filter",
      "position": [
        -944,
        208
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4aa3c2d2-9383-4b0c-a8ee-8a691dcd8744",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.URL }}",
              "rightValue": ""
            },
            {
              "id": "81017b55-ffb5-497c-8b05-5d2643e3fecd",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.Anchors }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3b41fbd6-fdf0-43e7-b2ac-db6f49869370",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -400,
        208
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "26244ced-732e-4e26-93d8-d6dbdf15e3a5",
      "name": "Générateur d'ancres",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        96,
        224
      ],
      "parameters": {
        "text": "=# Context\nYou are an SEO expert specialized in internal linking optimization. Your mission is to create optimized link anchors for natural referencing with all their linguistic variations.\n# Task\nBased on the provided information about a web page, generate 10 different SEO anchors with all linguistic variations that can be used to create internal links to this page from other pages of the site.\n# Input Data\n\nPage URL: {{ $json.URL }}\nPage Name/Title: {{ $json['Niv 0'] }}{{ $json['Niv 1'] }}{{ $json['Niv 2'] }}{{ $json['Niv 3'] }}\nContent Description: {{ $json['Description de la page'] }}\n\n# Instructions for Anchor Generation\n## SEO Criteria to Follow:\n\nSemantic relevance: The anchor must faithfully reflect the content of the target page\nStrategic keywords: Integrate the main keywords of the target page\nNaturalness: The anchor must integrate naturally into text\nDiversity: Vary formulations to avoid over-optimization\nOptimal length: Between 2 and 6 words for maximum efficiency\n\n## Types of Anchors to Create:\n\nExact anchors: Use the exact main keyword (2 variants)\nBrand/name anchors: Use the page or section name (2 variants)\nLong-tail anchors: Longer expressions including secondary keywords (3 variants)\nContextual anchors: Natural formulations for insertion in a paragraph (2 variants)\nCall-to-action anchors: Encourage action while describing content (1 variant)\n\n## Linguistic Variations to Generate for Each Anchor:\nFor each main anchor, systematically generate:\n\nSingular/plural variation (if applicable)\nGender variation: masculine/feminine (if applicable)\nTemporal variation: present/past/future (if applicable)\nFormal/informal variation: formal/casual register\nSynonymous variation: use of main synonyms\nStructural variation: word order inversion, addition/removal of articles\nPrepositional variation: with/without prepositions (to, of, for, on, etc.)\n\n# Desired Output Format\nmain anchor 1\nvariation 1\nvariation 2\nvariation 3\nvariation 4\nmain anchor 2\nvariation 1\nvariation 2\nvariation 3\nvariation 4\nmain anchor 3\nvariation 1\nvariation 2\nvariation 3\nvariation 4\nmain anchor 4\nvariation 1\nvariation 2\nvariation 3\nvariation 4\nmain anchor 5\nvariation 1\nvariation 2\nvariation 3\nvariation 4\nmain anchor 6\nvariation 1\nvariation 2\nvariation 3\nvariation 4\nmain anchor 7\nvariation 1\nvariation 2\nvariation 3\nvariation 4\nmain anchor 8\nvariation 1\nvariation 2\nvariation 3\nvariation 4\nmain anchor 9\nvariation 1\nvariation 2\nvariation 3\nvariation 4\nmain anchor 10\nvariation 1\nvariation 2\nvariation 3\nvariation 4\n# Additional Constraints\n\nAvoid generic anchors (\"click here\", \"learn more\", \"read more\")\nDon't repeat exactly the same formulation between main anchors and their variations\nAdapt the language register to the website's tone\nPrioritize added value for the user\nEnsure balanced distribution between different types of anchors\nGenerate 3-5 relevant variations per anchor (not necessarily 4 if certain variations don't apply)\nPrioritize quality of variations over quantity\n\nDon't make an introduction or conclusion to your response, simply return the list of anchors with their variations.\nGenerate now 10 optimized SEO anchors with all their linguistic variations for the described page.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "a498c4b3-1a95-41cf-ac41-c9f5d6f37c61",
      "name": "Anthropic 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        80,
        400
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-20250514",
          "cachedResultName": "Claude 4 Sonnet"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "id": "WXQf5QsxCs3AyxlW",
          "name": "Anthropic account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "4296eb85-78a4-4c38-ad7d-a080d3b8b07a",
      "name": "更新表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1312,
        224
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Anchor"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('When chat message received').item.json.chatInput }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wBRLUCktxqXE6DVJ",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "a8c0d205-ff46-4cd9-89c2-11be32cd90f0",
      "name": "导入表格",
      "type": "n8n-nodes-base.code",
      "position": [
        912,
        224
      ],
      "parameters": {
        "jsCode": "// Code avec conservation de toutes les colonnes existantes\nconst items = [];\n\n// Récupérer les données de vos différents nodes  \nconst loopItem = $('Loop Over Items').item.json;\nconst aiAgentOutput = $input.first().json.output;\n\n// Créer l'objet avec toutes les colonnes et le mapping des nouvelles valeurs\nconst transformedItem = {\n  // Copier toutes les propriétés existantes\n  ...loopItem,\n  \n  // Écraser/ajouter les nouvelles valeurs\n  'Ancre': aiAgentOutput\n};\n\n// Retourner l'item transformé\nitems.push(transformedItem);\nreturn items;"
      },
      "typeVersion": 2
    },
    {
      "id": "eba6bb70-cd87-485b-8f91-dad6ef78c8dc",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1824,
        112
      ],
      "parameters": {
        "color": 4,
        "width": 608,
        "height": 288,
        "content": "# 阶段 1:工作流初始化"
      },
      "typeVersion": 1
    },
    {
      "id": "7a2d141f-442b-475f-af20-69edd9111637",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        112
      ],
      "parameters": {
        "color": 3,
        "width": 688,
        "height": 432,
        "content": "# 阶段 4:AI 驱动的锚文本生成"
      },
      "typeVersion": 1
    },
    {
      "id": "c088d3ac-bef8-4191-be23-a5084171ba55",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        112
      ],
      "parameters": {
        "width": 896,
        "height": 304,
        "content": "# 阶段 5:数据集成和 Google Sheets 更新"
      },
      "typeVersion": 1
    },
    {
      "id": "3fd478d7-3082-4e37-9ef7-6b492d29b53a",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1824,
        448
      ],
      "parameters": {
        "color": 4,
        "width": 608,
        "height": 592,
        "content": "### 您需要做的:"
      },
      "typeVersion": 1
    },
    {
      "id": "95720cff-a480-48e8-aa19-d1250c199b8f",
      "name": "获取表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1440,
        208
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Anchor"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('When chat message received').item.json.chatInput }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wBRLUCktxqXE6DVJ",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e5d907dc-e34c-431a-8f30-f8d95ada7daf",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        112
      ],
      "parameters": {
        "width": 528,
        "height": 288,
        "content": "# 阶段 2:数据过滤和验证"
      },
      "typeVersion": 1
    },
    {
      "id": "0f5cec09-d540-4c79-8946-ac486a4d9e71",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        448
      ],
      "parameters": {
        "width": 528,
        "height": 304,
        "content": "### 系统执行的操作:"
      },
      "typeVersion": 1
    },
    {
      "id": "f16841d6-b2ba-4dab-b057-608030855427",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -624,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 528,
        "height": 288,
        "content": "# 阶段 3:批处理设置"
      },
      "typeVersion": 1
    },
    {
      "id": "02cd635e-9b37-48e7-ac4e-5942745a1885",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -624,
        448
      ],
      "parameters": {
        "color": 7,
        "width": 528,
        "height": 288,
        "content": "### 系统执行的操作:"
      },
      "typeVersion": 1
    },
    {
      "id": "b47f1ce3-a4bf-4da7-b0a4-10cde82ab188",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        576
      ],
      "parameters": {
        "color": 3,
        "width": 688,
        "height": 400,
        "content": "## 系统执行的操作:"
      },
      "typeVersion": 1
    },
    {
      "id": "7939bb48-faf1-4f4c-830e-84142302b900",
      "name": "### 替换 Airtable 连接",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        448
      ],
      "parameters": {
        "width": 896,
        "height": 416,
        "content": "## 系统执行的操作:"
      },
      "typeVersion": 1
    },
    {
      "id": "e1c3fd04-0438-4956-86d3-7a9810b06510",
      "name": "便签13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2816,
        112
      ],
      "parameters": {
        "width": 816,
        "height": 336,
        "content": "## 需要更高级的自动化解决方案?联系我们获取定制企业工作流!"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Filter": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ge sheets": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Import Sheets": {
      "main": [
        [
          {
            "node": "Update sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update sheets": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Générateur d'ancres",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Générateur d'ancres",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Générateur d'ancres": {
      "main": [
        [
          {
            "node": "Import Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Ge sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量19
分类2
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流