{
  "name": "AI Content Machine - Free 005 SEO Metadata Pack Builder",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [0, 0],
      "id": "d1700500-0000-4000-8000-000000000001",
      "name": "When clicking 'Execute workflow'"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "d1700500-0000-4000-8000-000000000002", "name": "article_title", "value": "How to Build an n8n Content Validation Workflow", "type": "string" },
            { "id": "d1700500-0000-4000-8000-000000000003", "name": "primary_keyword", "value": "n8n content validation", "type": "string" },
            { "id": "d1700500-0000-4000-8000-000000000004", "name": "excerpt", "value": "Learn how to stop incomplete content inputs before they reach an AI model using a credential-free n8n workflow.", "type": "string" },
            { "id": "d1700500-0000-4000-8000-000000000005", "name": "canonical_path", "value": "/articles/n8n-content-validation-workflow", "type": "string" }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [260, 0],
      "id": "d1700500-0000-4000-8000-000000000006",
      "name": "Sample Article Metadata"
    },
    {
      "parameters": {
        "jsCode": "const input = $input.first().json;\nconst required = ['article_title', 'primary_keyword', 'excerpt', 'canonical_path'];\nconst missing = required.filter((key) => !String(input[key] ?? '').trim());\nif (missing.length) throw new Error(`SEO metadata cannot be built. Missing required fields: ${missing.join(', ')}`);\nconst slug = String(input.article_title).normalize('NFD').replace(/[\\u0300-\\u036f]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');\nconst seoTitle = String(input.article_title).trim().slice(0, 60);\nconst metaDescription = String(input.excerpt).trim().slice(0, 160);\nconst path = String(input.canonical_path).trim().startsWith('/') ? String(input.canonical_path).trim() : `/${String(input.canonical_path).trim()}`;\nreturn [{ json: { ...input, slug, seo_title: seoTitle, meta_description: metaDescription, canonical_url: `https://theaicontentmachine.company${path}`, title_length: seoTitle.length, description_length: metaDescription.length, status: 'seo_ready', workflow_stage: 'seo_metadata' } }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [520, 0],
      "id": "d1700500-0000-4000-8000-000000000007",
      "name": "Build SEO Metadata Pack"
    }
  ],
  "connections": {
    "When clicking 'Execute workflow'": { "main": [[{ "node": "Sample Article Metadata", "type": "main", "index": 0 }]] },
    "Sample Article Metadata": { "main": [[{ "node": "Build SEO Metadata Pack", "type": "main", "index": 0 }]] }
  },
  "pinData": {},
  "active": false,
  "settings": { "executionOrder": "v1" },
  "tags": []
}
