{
  "name": "WF-Technical",
  "nodes": [
    {
      "parameters": {},
      "id": "76974720-631d-4467-b525-4c0cfb633005",
      "name": "Start",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        288,
        352
      ]
    },
    {
      "parameters": {
        "authentication": "serviceAccount",
        "operation": "getAll",
        "documentId": "={{ $env.GOOGLE_SHEET_ID }}",
        "sheetName": "Master",
        "options": {}
      },
      "id": "e6f47721-a46c-4861-bf29-195c9600a74e",
      "name": "Read Master Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [
        512,
        352
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {},
          "conditions": [
            {
              "id": "filter-sitemap-urls",
              "leftValue": "={{ $json.IncludeInSitemap }}",
              "rightValue": "TRUE",
              "operator": {
                "type": "string",
                "operation": "equals",
                "singleValue": true
              }
            }
          ],
          "combineOperation": "and"
        },
        "options": {}
      },
      "id": "74889c62-8706-4447-aa6b-f495513f57ef",
      "name": "Filter for Sitemap URLs",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2,
      "position": [
        736,
        352
      ]
    },
    {
      "parameters": {
        "jsCode": "// Generate sitemap XML\nconst urls = items.map(item => item.json.URL);\n\nfunction buildSitemap(urls) {\n  let xml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n';\n  xml += '<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\\n';\n  urls.forEach(url => {\n    xml += `  <url>\\n`;\n    xml += `    <loc>${url}</loc>\\n`;\n    xml += `  </url>\\n`;\n  });\n  xml += '</urlset>';\n  return xml;\n}\n\nreturn [{ json: { sitemapXml: buildSitemap(urls) } }];"
      },
      "id": "8627883b-9366-41e7-8b09-b42555c82662",
      "name": "Generate Sitemap XML",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        352
      ]
    },
    {
      "parameters": {
        "jsCode": "// Generate robots.txt\nconst siteRoot = 'https://your-domain.com';\nconst sitemapUrl = siteRoot + '/sitemap.xml';\n\nfunction buildRobotsTxt(siteRoot, sitemapUrl) {\n  let txt = '';\n  txt += 'User-agent: *\\n';\n  txt += 'Allow: /\\n';\n  txt += 'Disallow: /admin\\n';\n  txt += 'Disallow: /wp-admin\\n';\n  txt += `Sitemap: ${sitemapUrl}\\n`;\n  return txt;\n}\n\nreturn [{ json: { robotsTxt: buildRobotsTxt(siteRoot, sitemapUrl) } }];"
      },
      "id": "a901043b-7489-4b13-a417-7429188d8b44",
      "name": "Generate robots.txt",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        512
      ]
    },
    {
      "parameters": {
        "authentication": "credentials",
        "fileName": "sitemap.xml",
        "fileData": "={{ $json.sitemapXml }}",
        "path": "/public_html",
        "fileEncoding": "utf8",
        "options": {}
      },
      "id": "a189f41b-665e-49b9-8d7b-402a11b658ef",
      "name": "SFTP Upload Sitemap",
      "type": "n8n-nodes-base.sftp",
      "typeVersion": 1,
      "position": [
        1184,
        352
      ]
    },
    {
      "parameters": {
        "authentication": "credentials",
        "fileName": "robots.txt",
        "fileData": "={{ $json.robotsTxt }}",
        "path": "/public_html",
        "fileEncoding": "utf8",
        "options": {}
      },
      "id": "2262d29b-8e10-482d-9477-8c3395c3451e",
      "name": "SFTP Upload robots.txt",
      "type": "n8n-nodes-base.sftp",
      "typeVersion": 1,
      "position": [
        1184,
        512
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Read Master Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Master Sheet": {
      "main": [
        [
          {
            "node": "Filter for Sitemap URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter for Sitemap URLs": {
      "main": [
        [
          {
            "node": "Generate Sitemap XML",
            "type": "main",
            "index": 0
          },
          {
            "node": "Generate robots.txt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Sitemap XML": {
      "main": [
        [
          {
            "node": "SFTP Upload Sitemap",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate robots.txt": {
      "main": [
        [
          {
            "node": "SFTP Upload robots.txt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "id": "d0e2d1a3-2c1b-4b2a-92f7-8e6d2a8b3e8e"
}