✍️ Blog Post Generator
🎯 Mục tiêu bài học
Sau bài học này, bạn sẽ:
✅ Xây dựng multi-step blog generation pipeline
✅ Tạo outline từ topic với AI
✅ Viết sections tuần tự với Loop node
✅ Polish content và SEO optimize trước khi publish
Build automated pipeline: keyword/topic đầu vào, blog post hoàn chỉnh đầu ra. Multi-step AI workflow.
🏗️ Pipeline Architecture
Checkpoint
Blog generation pipeline gồm những bước chính nào?
📝 Step 1: Topic to Outline
1// OpenAI Node 1: Generate Outline2const outlinePrompt = `3Create a detailed blog post outline for the topic: "${$json.topic}"45Target audience: ${$json.audience || "tech professionals"}6Tone: ${$json.tone || "professional yet approachable"}7Word count target: ${$json.wordCount || 1500}89Return JSON:10{11 "title": "SEO-optimized title",12 "metaDescription": "155 chars max",13 "sections": [14 {15 "heading": "H2 heading",16 "subHeadings": ["H3 sub-heading 1", "..."],17 "keyPoints": ["point 1", "point 2"],18 "estimatedWords": 30019 }20 ],21 "suggestedTags": ["tag1", "tag2"]22}`;Checkpoint
Outline prompt yêu cầu AI trả về những thông tin gì?
🔄 Step 2: Section-by-Section Writing
1// Code node: Prepare section prompts2const outline = JSON.parse($json.message.content);3const sections = outline.sections;45// Create items for Loop node6return sections.map((section, index) => ({7 json: {8 sectionIndex: index,9 heading: section.heading,10 subHeadings: section.subHeadings,11 keyPoints: section.keyPoints,12 totalSections: sections.length,13 topic: $json.topic,14 tone: $json.tone || "professional"15 }16}));1// OpenAI Node 2: Write each section (inside Loop)2const writePrompt = `3Write section ${$json.sectionIndex + 1} of ${$json.totalSections} 4for a blog post about "${$json.topic}".56Section heading: ${$json.heading}7Sub-headings: ${$json.subHeadings.join(", ")}8Key points to cover: ${$json.keyPoints.join("; ")}9Tone: ${$json.tone}1011Write engaging, informative content. Include:12- Clear explanations13- Practical examples where relevant14- Smooth transitions15- About ${$json.estimatedWords || 300} words1617Return the section content in Markdown format.`;Checkpoint
Loop node đóng vai trò gì trong section-by-section writing?
✨ Step 3: Edit and Polish
1// OpenAI Node 3: Edit full draft2const editPrompt = `3You are a professional editor. Review and improve this blog post draft:45${$json.fullDraft}67Tasks:81. Fix any grammar or spelling errors92. Improve flow between sections103. Ensure consistent tone throughout114. Add engaging intro and conclusion125. Improve readability (short paragraphs, varied sentence length)1314Return the polished version in Markdown.`;Checkpoint
AI Editor thực hiện những task cải thiện nào cho draft?
🔍 Step 4: SEO Optimization
1// OpenAI Node 4: SEO optimize2const seoPrompt = `3Optimize this blog post for SEO:45Title: ${$json.title}6Content: ${$json.content}78Return JSON:9{10 "optimizedTitle": "SEO title (50-60 chars)",11 "metaDescription": "Meta description (150-155 chars)",12 "slug": "url-friendly-slug",13 "focusKeyword": "main keyword",14 "tags": ["tag1", "tag2", "tag3"],15 "internalLinkSuggestions": ["related topic 1", "related topic 2"]16}`;Checkpoint
SEO optimization step trả về những thông tin gì?
🚀 Step 5: Publish
1// WordPress node or HTTP Request node2// POST to WordPress REST API3const publishData = {4 title: $json.seoData.optimizedTitle,5 content: $json.polishedContent,6 status: $json.autoPublish ? "publish" : "draft",7 slug: $json.seoData.slug,8 meta: {9 description: $json.seoData.metaDescription10 },11 tags: $json.seoData.tags12};1314return publishData;Checkpoint
Khi nào nên auto-publish và khi nào nên save as draft?
🏗️ Full Workflow Example
Mỗi blog post (1500 words) tốn khoảng 2000-3000 input tokens + 2000 output tokens qua 4 AI steps. Với GPT-4o-mini, chi phí khoảng $0.002 per post.
Checkpoint
Chi phí ước tính để generate một blog post 1500 words là bao nhiêu?
📝 Bài Tập Thực Hành
- Build outline generator — input topic, output structured outline
- Add section-by-section writing với Loop node
- Implement edit step với grammar and style checks
- Connect to WordPress hoặc save as Google Doc
Checkpoint
Bạn đã hoàn thành blog pipeline chưa? Test với topic nào?
🚀 Bài tiếp theo
Social Media Content — Tự động tạo content cho nhiều social media platforms.
