8
n8n 한국어amn8n.com

Squarespace 코드注入을 Github에 백업합니다.

고급

이것은Engineering, Marketing분야의자동화 워크플로우로, 17개의 노드를 포함합니다.주로 If, Set, Code, Merge, Github 등의 노드를 사용하며. Squarespace 코드注入을 Github에 백업합니다.

사전 요구사항
  • GitHub Personal Access Token
  • 대상 API의 인증 정보가 필요할 수 있음
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "id": "eB4rTdZFvrdKK5VP",
  "meta": {
    "instanceId": "e634e668fe1fc93a75c4f2a7fc0dad807ca318b79654157eadb9578496acbc76",
    "templateCredsSetupCompleted": true
  },
  "name": "Backup Squarespace code Injections to Github",
  "tags": [
    {
      "id": "oIxDbURnjwrJFwau",
      "name": "Squarespace",
      "createdAt": "2025-03-06T05:49:51.612Z",
      "updatedAt": "2025-03-06T05:49:51.612Z"
    }
  ],
  "nodes": [
    {
      "id": "e0811eee-5bfe-4e48-8bd2-76b415261e93",
      "name": "'실행' 클릭 시",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        820,
        486.1164603611751
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e48028e0-d88a-4681-84b8-fa17fe695344",
      "name": "항목 루프",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2380,
        580
      ],
      "parameters": {
        "options": {},
        "batchSize": 2
      },
      "typeVersion": 3,
      "alwaysOutputData": true
    },
    {
      "id": "0dd2a2b1-8c19-4d7a-a631-d934320bcf74",
      "name": "스케줄 트리거",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        820,
        686.1164603611751
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 2
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a1bc1313-5993-4d10-b322-0b31dd005d00",
      "name": "스티키 노트1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        240
      ],
      "parameters": {
        "color": 4,
        "width": 371.1995072042308,
        "height": 600.88409546716,
        "content": "## Backup to GitHub \nThis workflow will backup Squarespace header & footer Injections to Github\n\n\n### Setup\n👉 Edit the Squarespace node to place the website URL there\n\n👉 Open `Globals` node and update the values below 👇\n\n- **repo.owner:** your Github username\n- **repo.name:** the name of your repository\n- **repo.path:** the folder to use within the repository.\n\n\nIf your username was `john-doe` and your repository was called `n8n-backups` and you wanted the injections to go into a `squarespace-backup` folder you would set:\n\n- repo.owner - john-doe\n- repo.name - n8n-backups\n- repo.path - squarespace-backup/\n\nEach site's injections will be added into seperate folder\n"
      },
      "typeVersion": 1
    },
    {
      "id": "125b425c-1f59-4984-8658-e57d3145cccd",
      "name": "스티키 노트2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        400
      ],
      "parameters": {
        "color": 7,
        "width": 1066,
        "height": 435,
        "content": "## Main workflow loop"
      },
      "typeVersion": 1
    },
    {
      "id": "626d534f-f2fb-4493-af58-0f5e309c58d4",
      "name": "Squarespace 데이터 가져오기",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1140,
        600
      ],
      "parameters": {
        "url": "https://beyondspace.studio",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "format",
              "value": "page-context"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e2b1481e-b9de-4006-92b6-4677b4e11213",
      "name": "스티키 노트4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        460
      ],
      "parameters": {
        "color": 4,
        "width": 170,
        "height": 120,
        "content": "## Edit this node 👇\nSquarespace URL"
      },
      "typeVersion": 1
    },
    {
      "id": "e8fb73af-9999-43cd-9857-564a049b2579",
      "name": "조건문",
      "type": "n8n-nodes-base.if",
      "position": [
        3060,
        600
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0f6f0b04-6d87-47fb-bee7-df2c93283d1c",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.error }}",
              "rightValue": "The resource you are requesting could not be found"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "679cd20a-c124-4f89-aea3-14dc5a739826",
      "name": "Footers 정리",
      "type": "n8n-nodes-base.code",
      "position": [
        1620,
        460
      ],
      "parameters": {
        "jsCode": "const cheerio = require('cheerio');\n\ntry {\n    const $footers = cheerio.load($input.first().json.value);\n    let sqsFooters = '';\n\n    /** CLEAN FOOTERS */\n    // Remove all elements after and including .social-icons-svg\n    const socialIcons = $footers('[data-usage=social-icons-svg]');\n    if (socialIcons.length) {\n        socialIcons.nextAll().remove(); // Remove everything after it\n        socialIcons.remove(); // Remove the element itself\n    }\n\n    // Extract cleaned-up footer content\n    $footers('head').each((i, el) => {\n        sqsFooters += $footers(el).html();\n    });\n\n    // Remove excessive newlines caused by removed elements\n    sqsFooters = sqsFooters.replace(/\\n{2,}/g, '\\n').trim();\n\n    return [{\n        ...$input.first().json,\n        value: sqsFooters,\n    }];\n} catch (error) {\n    console.error('Error processing Squarespace footers:', error);\n\n    // Return the original full input in case of failure\n    return [{\n        ...$input.first().json,\n        value: $input.first().json.value,\n    }];\n}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "92150603-acbd-41bf-8cf2-b6891e08e326",
      "name": "Headers 정리",
      "type": "n8n-nodes-base.code",
      "position": [
        1620,
        680
      ],
      "parameters": {
        "jsCode": "const cheerio = require('cheerio');\n\ntry {\n    const $headers = cheerio.load($input.first().json.value);\n    let sqsHeaders = '';\n\n    // Find the Squarespace CSS link that marks the start of relevant headers\n    const $headerStart = $headers('link[href*=\"static1.squarespace.com/static/versioned-site-css\"][href*=\"site.css\"]');\n\n    // Remove all elements before and including the header start\n    if ($headerStart.length) {\n        $headers($headerStart).prevAll().remove();\n        $headers($headerStart).remove();\n    }\n\n    // Remove Squarespace's cookie banner script (marks the end) and any following elements\n    const cookieBannerScript = $headers('script').filter((_, el) => \n        $headers(el).html().includes('Static.COOKIE_BANNER_CAPABLE = true;')\n    );\n    if (cookieBannerScript.length) {\n        cookieBannerScript.nextAll().remove(); // Remove everything after it\n        cookieBannerScript.remove(); // Remove the script itself\n    }\n\n    // Extract cleaned-up headers\n    $headers('head').each((i, el) => {\n        sqsHeaders += $headers(el).html();\n    });\n\n    // Remove any unwanted comments or placeholders\n    sqsHeaders = sqsHeaders.replace('<!-- End of Squarespace Headers -->', '');\n\n    // Remove excessive newlines caused by removed elements\n    sqsHeaders = sqsHeaders.replace(/\\n{2,}/g, '\\n').trim();\n\n    return [{\n        ...$input.first().json,\n        value: sqsHeaders,\n    }];\n} catch (error) {\n    console.log('Error processing Squarespace headers:', error);\n    \n    // Return the original full input in case of failure\n    return [{\n        ...$input.first().json,\n        value: $input.first().json.value,\n    }];\n}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a777d9ca-2841-47dc-a4d5-5ae36713d4a2",
      "name": "Footer Injection 가져오기",
      "type": "n8n-nodes-base.set",
      "position": [
        1380,
        460
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "49e2fd3c-d46e-42a0-84d5-578166c1fbae",
              "name": "value",
              "type": "string",
              "value": "={{ $json[\"squarespace-footers\"] }}"
            },
            {
              "id": "b2de857c-2120-4e7e-81d8-bb73dd059261",
              "name": "id",
              "type": "string",
              "value": "footers"
            },
            {
              "id": "14de0bc4-6a40-488d-a17e-0ff940a8d38b",
              "name": "name",
              "type": "string",
              "value": "footers"
            },
            {
              "id": "065cb5cd-b9fd-4aab-90be-5191e96d9b91",
              "name": "timestamp",
              "type": "string",
              "value": "={{ new Date().getTime() }}"
            },
            {
              "id": "41016a39-abf7-46ce-88b9-985553210983",
              "name": "domain",
              "type": "string",
              "value": "={{ ($json.website.primaryDomain || $json.website.authenticUrl || $json.website.internalUrl).replace(/^(?:https?:\\/\\/)?(?:www\\.)?/, '') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c8cdf09b-0218-4dbc-9564-e84d123ad5d7",
      "name": "Header Injection 가져오기",
      "type": "n8n-nodes-base.set",
      "position": [
        1380,
        680
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "49e2fd3c-d46e-42a0-84d5-578166c1fbae",
              "name": "value",
              "type": "string",
              "value": "={{ $json[\"squarespace-headers\"] }}"
            },
            {
              "id": "3d64cbd1-d571-4b59-b9cc-d6d0cb9f1dda",
              "name": "id",
              "type": "string",
              "value": "headers"
            },
            {
              "id": "42d56c77-3f2b-4ea6-b3c9-754e293c0615",
              "name": "name",
              "type": "string",
              "value": "headers"
            },
            {
              "id": "b3d13c06-6a4a-4478-ad14-8e0b7a2998e0",
              "name": "timestamp",
              "type": "string",
              "value": "={{ new Date().getTime() }}"
            },
            {
              "id": "b0977682-f135-4546-a390-0a3777907e4f",
              "name": "domain",
              "type": "string",
              "value": "={{ ($json.website.primaryDomain || $json.website.authenticUrl || $json.website.internalUrl).replace(/^(?:https?:\\/\\/)?(?:www\\.)?/, '') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7ca88a4d-f438-4d3a-b3ce-e66f1dd3ae00",
      "name": "Injection 데이터 편집",
      "type": "n8n-nodes-base.github",
      "position": [
        2840,
        600
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.repo.owner }}"
        },
        "filePath": "={{ $json.repo.path }}{{ $('Loop Over Items').item.json.id }}.html",
        "resource": "file",
        "operation": "edit",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.repo.name }}"
        },
        "fileContent": "={{ $('Loop Over Items').item.json.value }}",
        "commitMessage": "=Backup at {{ new DateTime($('Loop Over Items').item.json.timestamp) }}"
      },
      "credentials": {
        "githubApi": {
          "id": "3FYHiPFtycAFT8V0",
          "name": "GitHub account"
        }
      },
      "typeVersion": 1,
      "continueOnFail": true,
      "alwaysOutputData": true
    },
    {
      "id": "34ae1cf2-0abb-4fec-b60c-35c44f92020d",
      "name": "Injection 데이터 생성",
      "type": "n8n-nodes-base.github",
      "position": [
        3280,
        620
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Globals').item.json.repo.owner }}"
        },
        "filePath": "={{ $('Globals').item.json.repo.path }}{{ $('Loop Over Items').item.json.id }}.html",
        "resource": "file",
        "repository": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Globals').item.json.repo.name }}"
        },
        "fileContent": "={{ $('Loop Over Items').item.json.value }}",
        "commitMessage": "=Backup at {{ new DateTime($('Loop Over Items').item.json.timestamp) }}"
      },
      "credentials": {
        "githubApi": {
          "id": "3FYHiPFtycAFT8V0",
          "name": "GitHub account"
        }
      },
      "typeVersion": 1,
      "continueOnFail": true,
      "alwaysOutputData": true
    },
    {
      "id": "40ae14ee-ce39-4706-898c-51957f52328d",
      "name": "전역 변수",
      "type": "n8n-nodes-base.set",
      "position": [
        2640,
        600
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6cf546c5-5737-4dbd-851b-17d68e0a3780",
              "name": "repo.owner",
              "type": "string",
              "value": "BeyondspaceStudio"
            },
            {
              "id": "452efa28-2dc6-4ea3-a7a2-c35d100d0382",
              "name": "repo.name",
              "type": "string",
              "value": "n8n-backup"
            },
            {
              "id": "81c4dc54-86bf-4432-a23f-22c7ea831e74",
              "name": "repo.path",
              "type": "string",
              "value": "=squarespace-backup/{{ $json.domain }}/"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d20a5274-66e8-4053-b29d-e814e67a3f0e",
      "name": "스티키 노트",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2600,
        480
      ],
      "parameters": {
        "color": 4,
        "width": 150,
        "height": 80,
        "content": "## Edit this node 👇"
      },
      "typeVersion": 1
    },
    {
      "id": "db43654b-22bc-4c0e-9b6a-6f1dded7deb8",
      "name": "Injections 병합",
      "type": "n8n-nodes-base.merge",
      "position": [
        2140,
        580
      ],
      "parameters": {},
      "typeVersion": 3
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {},
  "versionId": "dfe7ec9f-5b7a-4a9c-8b53-b0cc4bcc2d27",
  "connections": {
    "e8fb73af-9999-43cd-9857-564a049b2579": {
      "main": [
        [
          {
            "node": "34ae1cf2-0abb-4fec-b60c-35c44f92020d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "e48028e0-d88a-4681-84b8-fa17fe695344",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "40ae14ee-ce39-4706-898c-51957f52328d": {
      "main": [
        [
          {
            "node": "7ca88a4d-f438-4d3a-b3ce-e66f1dd3ae00",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e48028e0-d88a-4681-84b8-fa17fe695344": {
      "main": [
        [],
        [
          {
            "node": "40ae14ee-ce39-4706-898c-51957f52328d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "679cd20a-c124-4f89-aea3-14dc5a739826": {
      "main": [
        [
          {
            "node": "db43654b-22bc-4c0e-9b6a-6f1dded7deb8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "92150603-acbd-41bf-8cf2-b6891e08e326": {
      "main": [
        [
          {
            "node": "db43654b-22bc-4c0e-9b6a-6f1dded7deb8",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "db43654b-22bc-4c0e-9b6a-6f1dded7deb8": {
      "main": [
        [
          {
            "node": "e48028e0-d88a-4681-84b8-fa17fe695344",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0dd2a2b1-8c19-4d7a-a631-d934320bcf74": {
      "main": [
        [
          {
            "node": "626d534f-f2fb-4493-af58-0f5e309c58d4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7ca88a4d-f438-4d3a-b3ce-e66f1dd3ae00": {
      "main": [
        [
          {
            "node": "e8fb73af-9999-43cd-9857-564a049b2579",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a777d9ca-2841-47dc-a4d5-5ae36713d4a2": {
      "main": [
        [
          {
            "node": "679cd20a-c124-4f89-aea3-14dc5a739826",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c8cdf09b-0218-4dbc-9564-e84d123ad5d7": {
      "main": [
        [
          {
            "node": "92150603-acbd-41bf-8cf2-b6891e08e326",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "626d534f-f2fb-4493-af58-0f5e309c58d4": {
      "main": [
        [
          {
            "node": "c8cdf09b-0218-4dbc-9564-e84d123ad5d7",
            "type": "main",
            "index": 0
          },
          {
            "node": "a777d9ca-2841-47dc-a4d5-5ae36713d4a2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "34ae1cf2-0abb-4fec-b60c-35c44f92020d": {
      "main": [
        [
          {
            "node": "e48028e0-d88a-4681-84b8-fa17fe695344",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e0811eee-5bfe-4e48-8bd2-76b415261e93": {
      "main": [
        [
          {
            "node": "626d534f-f2fb-4493-af58-0f5e309c58d4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

이 워크플로우를 어떻게 사용하나요?

위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.

이 워크플로우는 어떤 시나리오에 적합한가요?

고급 - 엔지니어링, 마케팅

유료인가요?

이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.

워크플로우 정보
난이도
고급
노드 수17
카테고리2
노드 유형10
난이도 설명

고급 사용자를 위한 16+개 노드의 복잡한 워크플로우

저자
bangank36

bangank36

@bangank36

Automation specialist with 10+ years of experience helping SME website owners streamline their workflows—specializing in Squarespace, Shopify, and WordPress. Book an initial consultation for custom n8n automation using my link.

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34